nan -ffast-math
Antonio Bleile
bleile@askvisual.de
Thu Feb 5 10:53:00 GMT 2004
Hello,
I found a very strange behaviour in my application since
I used the -ffast-math flag. Please take a look on the following
example code (bug.c):
#include <math.h>
int main( int argc, char *argv )
{
float myNan = 0.0/0.0;
if( myNan == 0.0 )
printf("NAN == 0.0\n");
else
printf("NAN != 0.0\n");
}
When compiled without any flag, like "gcc bug.c"
the output of the program will be "NAN != 0.0".
When compiled with "gcc bug.c -ffast-math"
the output is "NAN == 0.0", which is, in my opinion,
wrong.
I'm running RedHat 8.0, gcc -v is:
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
Kind regards,
Toni
--
Antonio Bleile
ask - Innovative Visualisierungslösungen GmbH
Postfach 100 210
D-64202 Darmstadt (Old Europe)
tel: +49 6159/913839 fax: +49 6159/1612
web: www.askvisual.de email: bleile@askvisual.de
More information about the Gcc-bugs
mailing list