This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

nan -ffast-math


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]