]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix std::numeric_limits<__float128>::max_digits10 [PR121374]
authorJonathan Wakely <jwakely@redhat.com>
Tue, 19 Aug 2025 16:29:12 +0000 (17:29 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 21 Aug 2025 09:04:45 +0000 (10:04 +0100)
When I added this explicit specialization in r14-1433-gf150a084e25eaa I
used the wrong value for the number of mantissa digits (I used 112
instead of 113). Then when I refactored it in r14-1582-g6261d10521f9fd I
used the value calculated from the incorrect value (35 instead of 36).

libstdc++-v3/ChangeLog:

PR libstdc++/121374
* include/std/limits (numeric_limits<__float128>::max_digits10):
Fix value.
* testsuite/18_support/numeric_limits/128bit.cc: Check value.

libstdc++-v3/include/std/limits
libstdc++-v3/testsuite/18_support/numeric_limits/128bit.cc

index 3567a32840069a26a489e0d04669d5ab11c36c7d..49ce7c935e9daf773c92bca03900789a05ac0e59 100644 (file)
@@ -2128,7 +2128,7 @@ __glibcxx_float_n(128)
       static _GLIBCXX_USE_CONSTEXPR int digits = 113;
       static _GLIBCXX_USE_CONSTEXPR int digits10 = 33;
 #if __cplusplus >= 201103L
-      static constexpr int max_digits10 = 35;
+      static constexpr int max_digits10 = 36;
 #endif
       static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
       static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
index b13d83776ba39fa38f511fd832dca16336c9de8b..bf12b65f91a5e19d1658ab22478c1e94919cf65e 100644 (file)
@@ -4,6 +4,11 @@
 
 #if __SIZEOF_FLOAT128__
 __extension__ template class std::numeric_limits<__float128>;
+
+# if __cplusplus >= 201103L
+static_assert( std::numeric_limits<__float128>::max_digits10 == 36,
+              "PR libstdc++/121374" );
+# endif
 #endif
 
 #if __SIZEOF_INT128__