[Bug libstdc++/84949] -ffast-math bugged with respect to NaNs
christoph@lipka-koeln.de
gcc-bugzilla@gcc.gnu.org
Mon Mar 19 15:32:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84949
--- Comment #2 from Christoph Lipka <christoph@lipka-koeln.de> ---
Having dug a bit deeper, I notice another way in which NaNs are broken in
-ffinite-math-only mode:
Normally, NaNs should always compare NON-EQUAL, even when compared to itself.
In -ffinite-math-only mode, NaNs ALWAYS compare EQUAL, even when compared to a
totally different value (such as, say, 0.0).
I would disagree with the claim that "NaNs are there" in -ffinite-math-only
mode - de facto they're not. What is there is one or more representations that
cause all sorts of undefined behaviour, which just so _happens_ to include
rendering as "nan" when converted to a string.
So my point stands that std::numeric_limits<T>::has_quiet_NaN() should return
false when -ffinite-math-only is active.
More information about the Gcc-bugs
mailing list