public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/31354]  New: NaN should only fail comparisons for equality
@ 2007-03-25 22:22 tkoenig at gcc dot gnu dot org
  2007-03-25 22:27 ` [Bug middle-end/31354] " pinskia at gcc dot gnu dot org
  2007-04-28  0:31 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-03-25 22:22 UTC (permalink / raw)
  To: gcc-bugs

I'm guessing at middle-end here, maybe it is target...

I don't think it is correct for NaNs to fail any comparison.
They should only fail comparisons which include equality.

$ cat compare.c
#include <stdio.h>

int main()
{
   float nan, x;
   nan = 0.0;
   nan = nan / nan;
   x = 3.2;
   printf("%f\n", nan);
   printf("%d %d %d %d\n", x > nan, x < nan, x >= nan, x <= nan);
   return 0;
}
$ gcc compare.c && ./a.out
nan
0 0 0 0
$ gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /home/ig25/gcc/trunk/configure --prefix=/home/ig25
--enable-maintainer-mode --enable-languages=c,fortran
Thread model: posix
gcc version 4.3.0 20070317 (experimental)


-- 
           Summary: NaN should only fail comparisons for equality
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug middle-end/31354] NaN should only fail comparisons for equality
  2007-03-25 22:22 [Bug middle-end/31354] New: NaN should only fail comparisons for equality tkoenig at gcc dot gnu dot org
@ 2007-03-25 22:27 ` pinskia at gcc dot gnu dot org
  2007-04-28  0:31 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-03-25 22:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-03-26 00:27 -------
NaN's are unordered so they will compare false for ordered operators.


-- 


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


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

* [Bug middle-end/31354] NaN should only fail comparisons for equality
  2007-03-25 22:22 [Bug middle-end/31354] New: NaN should only fail comparisons for equality tkoenig at gcc dot gnu dot org
  2007-03-25 22:27 ` [Bug middle-end/31354] " pinskia at gcc dot gnu dot org
@ 2007-04-28  0:31 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-28  0:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-04-28 01:31 -------
Not a bug as already explained.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2007-04-28  0:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-25 22:22 [Bug middle-end/31354] New: NaN should only fail comparisons for equality tkoenig at gcc dot gnu dot org
2007-03-25 22:27 ` [Bug middle-end/31354] " pinskia at gcc dot gnu dot org
2007-04-28  0:31 ` pinskia 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).