This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/10902: comparing doubles is not consistent in gcc 3.3 (SuSE version)
- From: Jos van den Oever <jos at vandenoever dot info>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 21 May 2003 13:17:18 +0200
- Subject: Re: c++/10902: comparing doubles is not consistent in gcc 3.3 (SuSE version)
- References: <20030521102600.11431.qmail@sources.redhat.com>
Just a small addition to the bug report.
Compiling with -ffloat-store does not alleviate the problem.
This problem is not a problem of too much precision, but one of too little
precision.
The following comparison is true in gcc 3.3 (SuSE prerelease):
double(1) == double(1) - 134217728*DBL_EPSILON
According to the definition in <cfloat>, DBL_EPSILON is the smallest number
for which 1 - DBL_EPSILON != 1.