[PATCH] libstdc++: Fix __floating_to_chars_precision for __float128

Jonathan Wakely jwakely@redhat.com
Wed Feb 24 22:22:26 GMT 2021


On 24/02/21 17:14 -0500, Patrick Palka via Libstdc++ wrote:
>The code path in __floating_to_chars_precision for handling long double
>by going through printf now also handles __float128, so the condition
>that guards this code path needs to be updated accordingly.
>
>Tested on x86_64-pc-linux-gnu (i.e. it compiles :)), does this look OK
>for trunk?

Yes, Thanks.

>libstdc++-v3/ChangeLog:
>
>	* src/c++17/floating_to_chars.cc (__floating_to_chars_precision):
>	Relax the condition that guards the printf code path to accept
>	F128_type as well.
>---
> libstdc++-v3/src/c++17/floating_to_chars.cc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/libstdc++-v3/src/c++17/floating_to_chars.cc b/libstdc++-v3/src/c++17/floating_to_chars.cc
>index aea96e08df1..f1512017aa3 100644
>--- a/libstdc++-v3/src/c++17/floating_to_chars.cc
>+++ b/libstdc++-v3/src/c++17/floating_to_chars.cc
>@@ -1151,7 +1151,7 @@ template<typename T>
>
>     // Ryu doesn't support formatting floating-point types larger than double
>     // with an explicit precision, so instead we just go through printf.
>-    if constexpr (is_same_v<T, long double>)
>+    if constexpr (is_same_v<T, long double> || is_same_v<T, F128_type>)
>       {
> 	int effective_precision;
> 	const char* output_specifier;
>-- 
>2.30.1.602.g966e671106
>



More information about the Libstdc++ mailing list