https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104772
Bug ID: 104772 Summary: std::numeric_limits<__float128> should be specialized Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Depends on: 99708, 98202 Target Milestone: --- We should provide a specialization of numeric_limits<__float128> when that type is valid (even if is_floating_point_v<__float128> is false due to __STRICT_ANSI__ being defined). It might also be useful to do the same for __float80 on x86, although that's less widely used. That could be done fairly easily: #ifdef __SIZEOF_FLOAT80__ template<> numeric_limits<__float80> : numeric_limits<long double> { }; #endif For __float128 we need to define it fully. The compiler gives us the info we need: #define __FLT128_DECIMAL_DIG__ 36 #define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128 #define __FLT128_DIG__ 33 #define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128 #define __FLT128_HAS_DENORM__ 1 #define __FLT128_HAS_INFINITY__ 1 #define __FLT128_HAS_QUIET_NAN__ 1 #define __FLT128_IS_IEC_60559__ 2 #define __FLT128_MANT_DIG__ 113 #define __FLT128_MAX_10_EXP__ 4932 #define __FLT128_MAX_EXP__ 16384 #define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128 #define __FLT128_MIN_10_EXP__ (-4931) #define __FLT128_MIN_EXP__ (-16381) #define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128 #define __FLT128_NORM_MAX__ 1.18973149535723176508575932662800702e+4932F128 The F128 suffixes are a problem though, see PR 98202 comment 7. Detecting __float128 reliably is blocked by PR 99708 comment 8. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98202 [Bug 98202] C++ cannot parse F128 suffix for float128 literals https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99708 [Bug 99708] __SIZEOF_FLOAT128__ not defined on powerpc64le-linux