public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40643]  New: maxloc/minloc: Wrong result for NaN at position 1
@ 2009-07-03 18:15 burnus at gcc dot gnu dot org
  2009-07-03 19:30 ` [Bug fortran/40643] " jakub at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-07-03 18:15 UTC (permalink / raw)
  To: gcc-bugs

Per IEEE 754:2008, one has max(x,NaN) == max(NaN,x) == x. Gfortran's inline
version of maxloc, maxval and max (ditto for min*) follows this. However, the
libgfortran version does not:

real :: r(4), z
z = 0.0
r = (/ z/z, -1., -42., 849. /)
print *,r
print *, minloc(r), minval(r)
print *, maxloc(r), maxval(r)
end

Produces:

             NaN  -1.0000000      -42.000000       849.00000
           1  -42.000000
           1   849.00000

Correct is - as ifort has -:

 NaN             -1.000000      -42.00000       849.0000
           3  -42.00000
           4   849.0000


-- 
           Summary: maxloc/minloc: Wrong result for NaN at position 1
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-12-05 21:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-03 18:15 [Bug fortran/40643] New: maxloc/minloc: Wrong result for NaN at position 1 burnus at gcc dot gnu dot org
2009-07-03 19:30 ` [Bug fortran/40643] " jakub at gcc dot gnu dot org
2009-07-05  9:12 ` fxcoudert at gcc dot gnu dot org
2009-07-10 16:31 ` jakub at gcc dot gnu dot org
2009-07-10 19:03 ` burnus at gcc dot gnu dot org
2009-07-14 13:26 ` jakub at gcc dot gnu dot org
2009-07-14 13:31 ` jakub at gcc dot gnu dot org
2009-07-14 19:18 ` tkoenig at gcc dot gnu dot org
2009-07-24  7:57 ` jakub at gcc dot gnu dot org
2009-12-05 21:54 ` tkoenig at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).