The test program should consistently return
either 2.1 or NaN:

$ cat foo.f90
program main
  real :: nan
  nan = 0.0
  nan = nan / nan
  print *,max(2.1, nan)
  print *,max(nan, 2.1)
end program main
$ gfortran foo.f90
$ ./a.out
   2.100000
            NaN

A lot of compilers seem to get this wrong, as well.
Marking it as an enhancement.


-- 
           Summary: max / min and NaN
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org
OtherBugsDependingO 30694
             nThis:


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32048

Reply via email to