public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Disable std::format of _Float128 if std::to_chars is innaccurate
@ 2022-11-16 20:59 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2022-11-16 20:59 UTC (permalink / raw)
  To: libstdc++, gcc-patches

Tested x86_64-linux. Pushed to trunk.

-- >8 --

This restricts std::format support for _Float128 (and __float128) to
targets where glibc provides __strfromf128 and so can give correct
output.

libstdc++-v3/ChangeLog:

	* include/std/format [__FLT128_DIG__] (_GLIBCXX_FORMAT_F128):
	Only support formatting _Float128 when glibc provides the
	functionality needed for accurate std::to_chars.
---
 libstdc++-v3/include/std/format | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 204a1710aca..fb29f7e7835 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -1235,13 +1235,13 @@ namespace __format
   using __float128_t = long double;
 # define _GLIBCXX_FORMAT_F128 1
 
-#elif __FLT128_DIG__ && defined(__GLIBC_PREREQ) // see floating_to_chars.cc
+#elif __FLT128_DIG__ && defined(_GLIBCXX_HAVE_FLOAT128_MATH)
 
   // Format 128-bit floating-point types using _Float128.
   using __float128_t = _Float128;
 # define _GLIBCXX_FORMAT_F128 2
 
-# if __cplusplus == 202002L || !defined(_GLIBCXX_HAVE_FLOAT128_MATH)
+# if __cplusplus == 202002L
   // These overloads exist in the library, but are not declared for C++20.
   // Make them available as std::__format::to_chars.
   to_chars_result
-- 
2.38.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-16 20:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-16 20:59 [committed] libstdc++: Disable std::format of _Float128 if std::to_chars is innaccurate Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).