[Bug libstdc++/84949] -ffast-math bugged with respect to NaNs
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu May 3 12:24:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84949
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
std::numeric_limits<float> defines:
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent;
//...
static _GLIBCXX_USE_CONSTEXPR bool is_iec559
= has_infinity && has_quiet_NaN && has_denorm == denorm_present;
And that seems to be the right thing to do. If the compiler tells us the type
has infinities and NaNs then we expose that through std::numeric_limits.
I don't think we want the C++ library to be inconsistent with the compiler
here. So maybe any change should be in the compiler not libstdc++.
More information about the Gcc-bugs
mailing list