On Sun, 29 Dec 2024 at 10:01, Hans Åberg via Gcc-help <gcc-help@xxxxxxxxxxx> wrote: > > When checking the GCC 14.2 implementation of C++23 fixed width floating-point types in the header <stdfloat> [1]: > > The page [2] says that one should be able to write std::float128_t using std::formatter as it is using std::to_chars which is required to support all arithmetic type, but it does not work with GCC. It works fine for me. > But the wording suggests it has been working with GCC. And still is working. If it's not working for you, it must be a limitation of your OS, which you haven't told us. > Then using std::to_chars directly, I found what may be a error in the conversion from float to std::std::float64_t: I modify the code at [3] by adding to “main” > show_to_chars(+3.14159f64); > show_to_chars(std::float64_t{+3.14159F}); > and increasing, in “show_to_chars”, the bufsize to 20, I get the output: > "3.14159" > "3.141590118408203" > These extra decimals do not appear when using std::float32_t{+3.14159F}. I think this is expected. The value cannot be represented exactly as a 32-bit float, so when you convert it to a 64-bit double (or float64_t) there are extra bits. > Also, this code does not work with GCC when using, in “main”, any of > show_to_chars(+3.14159f128); > show_to_chars(std::float128_t{+3.14159F}); > > 1. https://en.cppreference.com/w/cpp/types/floating-point > 2. https://stackoverflow.com/questions/76500128/cant-use-operator-with-stdfloat128-t-how-do-i-print-it > 3. https://en.cppreference.com/w/cpp/utility/to_chars > >