Floating point comparison fails when done through a function call from a class. Release: gcc version 2.95.2 19991024 (release)(Using g++) Environment: Bug is only on Linux for x86 How-To-Repeat: The code contains the bug and its workaround
Fix: The workaround is in the file submitted
State-Changed-From-To: open->closed State-Changed-Why: This is not a bug, but a consequence of the CPU's FPU and in-memory representation of f.p. numbers being different. You cannot reliably use == to compare floating point numbers; you need to use fabs (a-b) < epsilon, or similar.
From: neil@gcc.gnu.org To: deshpand@cs.umn.edu, gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org Cc: Subject: Re: c++/629 Date: 4 Feb 2001 14:31:49 -0000 Synopsis: floating point comparison State-Changed-From-To: open->closed State-Changed-By: neil State-Changed-When: Sun Feb 4 06:31:49 2001 State-Changed-Why: This is not a bug, but a consequence of the CPU's FPU and in-memory representation of f.p. numbers being different. You cannot reliably use == to compare floating point numbers; you need to use fabs (a-b) < epsilon, or similar. http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=629&database=gcc
Reopening bug to mark bug as a dup of bug 323 so ...
that the number of dup goes up on that bug. *** This bug has been marked as a duplicate of 323 ***