re PR fortran/34192 (NEAREST can return wrong numbers)

2007-11-24  Tobias Burnus  <burnus@net-b.de>

       PR fortran/34192
       * gfortran.dg/nearest_2.f90: Add INF/NAN tests.

From-SVN: r130396
This commit is contained in:
Tobias Burnus 2007-11-24 14:18:27 +01:00 committed by Tobias Burnus
parent eba55d501f
commit 54b42fe269
2 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2007-11-24 Tobias Burnus <burnus@net-b.de>
PR fortran/34192
* gfortran.dg/nearest_2.f90: Add INF/NAN tests.
2007-11-24 Paul Thomas <pault@gcc.gnu.org>
PR fortran/33541

View File

@ -1,4 +1,5 @@
! { dg-do run }
! { dg-options "-fno-range-check" }
!
! PR fortran/34192
!
@ -76,6 +77,15 @@ program test
/= 42.0) &
call abort()
! INF+ = INF
if (nearest(1.0/0.0, 1.0) /= 1.0/0.0) call abort()
! -INF- = -INF
if (nearest(-1.0/0.0, -1.0) /= -1.0/0.0) call abort()
! NAN- = NAN
if (.not.isnan(nearest(0.0d0/0.0, 1.0))) call abort()
! NAN+ = NAN
if (.not.isnan(nearest(0.0d0/0.0, -1.0))) call abort()
! Double precision
! 0+ > 0
@ -144,4 +154,13 @@ program test
if (nearest(nearest(42.0d0, 1.0), -1.0) &
/= 42.0d0) &
call abort()
! INF+ = INF
if (nearest(1.0d0/0.0d0, 1.0) /= 1.0d0/0.0d0) call abort()
! -INF- = -INF
if (nearest(-1.0d0/0.0d0, -1.0) /= -1.0d0/0.0d0) call abort()
! NAN- = NAN
if (.not.isnan(nearest(0.0d0/0.0, 1.0))) call abort()
! NAN+ = NAN
if (.not.isnan(nearest(0.0d0/0.0, -1.0))) call abort()
end program test