Implementation of fixed width floating-point types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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. But the wording suggests it has been working with GCC.

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}.

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






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux