public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/104772] New: std::numeric_limits<__float128> should be specialized
Date: Thu, 03 Mar 2022 16:01:47 +0000	[thread overview]
Message-ID: <bug-104772-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 104772
           Summary: std::numeric_limits<__float128> should be specialized
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
        Depends on: 99708, 98202
  Target Milestone: ---

We should provide a specialization of numeric_limits<__float128> when that type
is valid (even if is_floating_point_v<__float128> is false due to
__STRICT_ANSI__ being defined).

It might also be useful to do the same for __float80 on x86, although that's
less widely used. That could be done fairly easily:

#ifdef __SIZEOF_FLOAT80__
template<>
numeric_limits<__float80> : numeric_limits<long double> { };
#endif

For __float128 we need to define it fully. The compiler gives us the info we
need:

#define __FLT128_DECIMAL_DIG__ 36
#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128
#define __FLT128_DIG__ 33
#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128
#define __FLT128_HAS_DENORM__ 1
#define __FLT128_HAS_INFINITY__ 1
#define __FLT128_HAS_QUIET_NAN__ 1
#define __FLT128_IS_IEC_60559__ 2
#define __FLT128_MANT_DIG__ 113
#define __FLT128_MAX_10_EXP__ 4932
#define __FLT128_MAX_EXP__ 16384
#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128
#define __FLT128_MIN_10_EXP__ (-4931)
#define __FLT128_MIN_EXP__ (-16381)
#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128
#define __FLT128_NORM_MAX__ 1.18973149535723176508575932662800702e+4932F128

The F128 suffixes are a problem though, see PR 98202 comment 7.

Detecting __float128 reliably is blocked by PR 99708 comment 8.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98202
[Bug 98202] C++ cannot parse F128 suffix for float128 literals
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99708
[Bug 99708] __SIZEOF_FLOAT128__ not defined on powerpc64le-linux

             reply	other threads:[~2022-03-03 16:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03 16:01 redi at gcc dot gnu.org [this message]
2022-03-03 16:11 ` [Bug libstdc++/104772] " redi at gcc dot gnu.org
2022-03-03 16:20 ` redi at gcc dot gnu.org
2022-03-08  0:24 ` redi at gcc dot gnu.org
2023-04-26  6:55 ` rguenth at gcc dot gnu.org
2023-05-16 18:53 ` jakub at gcc dot gnu.org
2023-05-16 18:57 ` redi at gcc dot gnu.org
2023-05-31 12:21 ` cvs-commit at gcc dot gnu.org
2023-05-31 12:32 ` redi at gcc dot gnu.org
2023-05-31 13:51 ` jakub at gcc dot gnu.org
2023-05-31 13:59 ` jakub at gcc dot gnu.org
2023-05-31 14:00 ` jakub at gcc dot gnu.org
2023-06-06 15:59 ` cvs-commit at gcc dot gnu.org
2023-06-06 16:19 ` redi at gcc dot gnu.org
2024-04-10 15:48 ` meissner 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-104772-4@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).