https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114623

--- Comment #2 from g.peterh...@t-online.de ---
#include <boost/cstdfloat.hpp>
#include <string_view>
#include <charconv>
#include <iostream>
#include <limits>
#include <array>
#include <cmath>

void print_hex(const std::float128_t value)
{
        std::array<char, 1024>
                buffer{};
        const std::to_chars_result
                result{std::to_chars(buffer.data(),
buffer.data()+buffer.size(), value, std::chars_format::hex)};

        std::cout << std::string_view{buffer.data(), result.ptr} << std::endl;
}

template <typename Type>
void    print_sqrt_max_hex()
{
        using limits = std::numeric_limits<Type>;

        print_hex(std::sqrt(limits::max()));
}

int main()
{
        print_sqrt_max_hex<std::float128_t>();
        print_sqrt_max_hex<__float128>();

        return EXIT_SUCCESS;
}

gets
1.ffffffffffffffffffffffffffffp+8191
1p+8192

Reply via email to