https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84949
Matthias Kretz <kretz at kde dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kretz at kde dot org --- Comment #6 from Matthias Kretz <kretz at kde dot org> --- I'd like to make a case for numeric_limits<floating-point>::is_iec559 to follow __STDC_IEC_559__. I.e. the following patch: --- a/libstdc++-v3/include/std/limits +++ b/libstdc++-v3/include/std/limits @@ -1649,7 +1649,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION denorm_min() _GLIBCXX_USE_NOEXCEPT { return __FLT_DENORM_MIN__; } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 +#ifdef __STDC_IEC_559__ = has_infinity && has_quiet_NaN && has_denorm == denorm_present; +#else + = false; +#endif static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; @@ -1724,7 +1728,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION denorm_min() _GLIBCXX_USE_NOEXCEPT { return __DBL_DENORM_MIN__; } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 +#ifdef __STDC_IEC_559__ = has_infinity && has_quiet_NaN && has_denorm == denorm_present; +#else + = false; +#endif static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; @@ -1799,7 +1807,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION denorm_min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_DENORM_MIN__; } static _GLIBCXX_USE_CONSTEXPR bool is_iec559 +#ifdef __STDC_IEC_559__ = has_infinity && has_quiet_NaN && has_denorm == denorm_present; +#else + = false; +#endif static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; The __STDC_IEC_559__ macro is not defined when -ffast-math is active. is_iec559 requires "true if and only if the type adheres to ISO/IEC/IEEE 60559". I don't have IEC559 at hand, but I believe assuming no NaN, inf, or -0 can occur makes the floating point types not adhere to IEC559. And IIUC, if __STDC_IEC_559__ is defined, then has_infinity, has_quiet_NaN and has_denorm must all be true. So +#ifdef __STDC_IEC_559__ + = true; +#else + = false; +#endif should be correct.