[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
**Subject**: **Re: Has anyone noticed -ffast-math (gcc) fights against NaN's?**
**From**: Miles Bader <miles@...>
**Date**: Wed, 08 Apr 2009 07:08:38 +0900

Asko Kauppi <askok@dnainternet.net> writes:
> I've been revising the LNUM patch (more of that later) and spend several
> hours today trying to understand what exactly -ffast-math does with
> regard to NaN's (not-a-numbers).
>
> Basically, it does not seem to know them. It gives nan==nan and other
> no-can-dos that I regard as Completely Evil as to Lua compatibility.
There's a list of what exactly -ffast-math does in the gcc manual (see
Taj Khattra's followup for a quote), but I just wanted to note that you
can tune it by following the -ffast-math option with finer-grained
options that reverse parts of its effect.
E.g., in my proggie, I use:
-ffast-math -fno-finite-math-only -ftrapping-math -fno-associative-math
"-fno-finite-math-only" and "-ftrapping-math" reverse some of the usual
effect of -ffast-math (-fno-associative-math is just to silence a
warning, as -ftrapping-math automatically implies that anyway).
-Miles
--
o The existentialist, not having a pillow, goes everywhere with the book by
Sullivan, _I am going to spit on your graves_.