Hi experts, I have a small test case, it got different result when compile with -O0 option and -O2 option. Is this a bug of gcc ?===============================test.c===============================#include <stdio.h>void test(double a){ double b; b = a * 100000.00000000000; if(a<0) printf("a<0\n"); else if(b == 19753086420000.0000000000) { a += 0.000005; printf("a+=0.000005\n"); } printf("a=%f\n",a);}int main(){ double a=987654321/5.0; test(a);}===========================================================result:=============================$ gcc -O0 test.c$ ./a.outa+=0.000005a=197530864.200005$ gcc -O2 test.c$ ./a.outa=197530864.200000========================================================== my gcc version: ============================= Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux Thread model: posix gcc version 3.4.6 20060404 ============================= Regards,Jianhao Mo _________________________________________________________________ MSN圣诞礼物火热登场,免费发放中,快来领取吧! http://im.live.cn/emoticons/?ID=18
_______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus