public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "g.peterhoff@t-online.de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libquadmath/114623] sqrtq and std::numeric_limits<__float128>::max()
Date: Sun, 07 Apr 2024 04:22:56 +0000	[thread overview]
Message-ID: <bug-114623-4-xPwETZWnCB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114623-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from g.peterhoff@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

  parent reply	other threads:[~2024-04-07  4:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-07  4:03 [Bug libquadmath/114623] New: sqrt g.peterhoff@t-online.de
2024-04-07  4:15 ` [Bug libquadmath/114623] sqrt pinskia at gcc dot gnu.org
2024-04-07  4:22 ` g.peterhoff@t-online.de [this message]
2024-04-07  4:41 ` [Bug libquadmath/114623] sqrtq and std::numeric_limits<__float128>::max() pinskia at gcc dot gnu.org
2024-04-07  5:20 ` g.peterhoff@t-online.de
2024-04-08  8:42 ` jakub at gcc dot gnu.org
2024-04-08 11:27 ` jakub at gcc dot gnu.org
2024-04-08 11:30 ` jakub at gcc dot gnu.org
2024-04-09  6:22 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-114623-4-xPwETZWnCB@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).