> On 4 Jan 2025, at 14:05, Hans Åberg via Gcc-help <gcc-help@xxxxxxxxxxx> wrote: > >> On 4 Jan 2025, at 13:27, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote: >> >> On Sat, 4 Jan 2025, 09:48 Hans Åberg, <haberg_1@xxxxxxxxxx> wrote: >> >> The C++ features are not implemented for some reason, as one can use the GNU <quadmath.h> library and adding to g++ the library option -lquadmath, as in this example: >> https://stackoverflow.com/questions/5451447/quadruple-precision-in-c-gcc >> >> That has nothing to do with std::to_chars or std::format. > > Could they not be implemented on top of that? I can implement C++ std::float128_t features using the <quadmath.h> library enough to get the above mentioned example working. Or so it seems, not sure about the details of the innards: The type std::float128_t expands to _Float128, and the quadmath library uses the type __float128, which is separate on MacOS both arm64 and x86_64, but using std::numeric_limits I can see that they have the binary128 precision (except that on arm64, std::numeric_limits<__float128>::digits gives value 0). This page does not say exactly what happens with _Float128 on these platforms. But there is conversion available between the types. So it seems to work with: std::float128_t modf(std::float128_t x, std::float128_t* y) { __float128 y0; __float128 r = modfq(x, &y0); *y = y0; return r; } Then using “quadmath_snprintf”, I wrote to_chars_result to_chars(char*, char*, float128_t) and from that, a version of formatter<float128_t, char> from the example at https://en.cppreference.com/w/cpp/utility/format/formatter