This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
nan -ffast-math
- From: Antonio Bleile <bleile at askvisual dot de>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 05 Feb 2004 11:52:14 +0100
- Subject: nan -ffast-math
- Reply-to: antonio dot bleile at askvisual dot de
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