This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: fix execute/intrinsic_nearest.f90
After some discussion on irc, we decided to just disable testing
of this partiuclar corner case until some bits of the next fortran
standard get implemented.
r~
* gfortran.fortran-torture/execute/intrinsic_nearest.f90: Disable
tests of nearest around zero.
Index: gfortran.fortran-torture/execute/intrinsic_nearest.f90
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_nearest.f90,v
retrieving revision 1.3
diff -c -p -d -r1.3 intrinsic_nearest.f90
*** gfortran.fortran-torture/execute/intrinsic_nearest.f90 30 Jun 2004 11:50:45 -0000 1.3
--- gfortran.fortran-torture/execute/intrinsic_nearest.f90 30 Jul 2004 22:26:29 -0000
***************
*** 1,7 ****
!Program to test NEAREST intrinsic function.
program test_nearest
! real s, r, x, y, inf, max, min
integer i, infi, maxi
equivalence (s,i)
equivalence (inf,infi)
--- 1,7 ----
!Program to test NEAREST intrinsic function.
program test_nearest
! real s, r, x, y, inf, max
integer i, infi, maxi
equivalence (s,i)
equivalence (inf,infi)
*************** program test_nearest
*** 25,43 ****
y = nearest(s, -r)
if (.not. (x .gt. s .and. y .lt. s )) call abort()
infi = z'7f800000'
maxi = z'7f7fffff'
- min = tiny(1.0)
call test_up(max, inf)
call test_up(-inf, -max)
- call test_up(0, min)
- call test_up(-min, 0)
-
call test_down(inf, max)
call test_down(-max, -inf)
! call test_down(0, -min)
! call test_down(min, 0)
end
subroutine test_up(s, e)
--- 25,50 ----
y = nearest(s, -r)
if (.not. (x .gt. s .and. y .lt. s )) call abort()
+ ! ??? This is pretty sketchy, but passes on most targets.
infi = z'7f800000'
maxi = z'7f7fffff'
call test_up(max, inf)
call test_up(-inf, -max)
call test_down(inf, max)
call test_down(-max, -inf)
!
! ! ??? Here we require the F2003 IEEE_ARITHMETIC module to
! ! determine if denormals are supported. If they are, then
! ! nearest(0,1) is the minimum denormal. If they are not,
! ! then it's the minimum normalized number, TINY. This fails
! ! much more often than the infinity test above, so it's
! ! disabled for now.
!
! ! call test_up(0, min)
! ! call test_up(-min, 0)
! ! call test_down(0, -min)
! ! call test_down(min, 0)
end
subroutine test_up(s, e)