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]

Re: nan -ffast-math


Antonio Bleile wrote:
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

This is what -ffast-math is desgined to do. See the documentation for this option.


-ffast-math results in faster FP code by making potentially unsafe simplifying assumptions, such as pretending that NaNs and Infinities don't exist. If your code requires NaNs and Infinities to work, then you can't use the -ffast-math option.

Recent gcc versions split -ffast-math into several suboptions, one of which is -ffinite-math-only, so you can choose whether you want NaNs and Infinities to work, while still getting the other benefits of -ffast-math.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



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