public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/40186]  New: floating point comparision works wrong ( !(a < b) && (b > a) is true )
@ 2009-05-18 13:08 ich at az2000 dot de
  2009-05-18 13:11 ` [Bug c++/40186] " ich at az2000 dot de
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: ich at az2000 dot de @ 2009-05-18 13:08 UTC (permalink / raw)
  To: gcc-bugs

When comparing the return value of two functions (which both return double and
do always return the same value), I have the case that (a < b) && (b < a)
(whereby they should be equal) in a real world application.

I tried to reproduce it, though in the test case, I have a slightly different
case, which should be also wrong: !(a < b) && (b > a) is true (whereby it
should be a == b).

Probably both problems are related.

The behaviour pretty much depend on the optimisation. With -O0 and -Os, I am
hitting the problem, but not so with -O1, -O2 and -O3.


-- 
           Summary: floating point comparision works wrong ( !(a < b) && (b
                    > a) is true )
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ich at az2000 dot de
 GCC build triplet: tried with GCC 4.1.2, 4.3.2 and 4.4.0
  GCC host triplet: Gentoo Linux i386
GCC target triplet: Linux i386


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


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

end of thread, other threads:[~2009-05-18 14:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-18 13:08 [Bug c++/40186] New: floating point comparision works wrong ( !(a < b) && (b > a) is true ) ich at az2000 dot de
2009-05-18 13:11 ` [Bug c++/40186] " ich at az2000 dot de
2009-05-18 13:16 ` ich at az2000 dot de
2009-05-18 13:17 ` ich at az2000 dot de
2009-05-18 13:38 ` [Bug c++/40186] floating point comparison is " ich at az2000 dot de
2009-05-18 14:12 ` pinskia at gcc dot gnu dot org
2009-05-18 14:49 ` pinskia at gcc dot gnu dot org
2009-05-18 14:53 ` sliwa at cft dot edu dot pl
2009-05-18 14:56 ` vincent at vinc17 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).