c++/10902: comparing doubles is not consistent in gcc 3.3 (SuSE version)

Jos van den Oever jos@vandenoever.info
Wed May 21 11:36:00 GMT 2003


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.



More information about the Gcc-bugs mailing list