The comparison between 0 and the largest power of 2 that fits in a long double gives a non-zero result!!!
Environment: System: OSF1 spe171.testdrive.hp.com V5.1 2650 alpha Architecture: alphaev56-dec-osf5.1 host: alphaev56-dec-osf5.1 build: alphaev56-dec-osf5.1 target: alphaev56-dec-osf5.1 configured with: ../configure How-To-Repeat: spe171.testdrive.hp.com> cat bug.c #include <stdio.h> #include <stdlib.h> #include <float.h> int main () { long double d; d = 1.0; while (d < LDBL_MAX / 2.0) d += d; printf ("d=%1.30Le\n", d); if (d == (long double) 0.0) printf ("d equals 0.0\n"); } spe171.testdrive.hp.com> gcc -O1 bug.c spe171.testdrive.hp.com> ./a.out d=5.948657476786158825428796633140e+4931 d equals 0.0 ------- Comment #1 from ehrhardt at mathematik dot uni-ulm dot de 2003-10-16 14:04 ------- Please read http://gcc.gnu.org/bugs.html. Also have a look at bug 323 and its duplicates. -- ehrhardt at mathematik dot uni-ulm dot de changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12639