public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/104772] New: std::numeric_limits<__float128> should be specialized
@ 2022-03-03 16:01 redi at gcc dot gnu.org
  2022-03-03 16:11 ` [Bug libstdc++/104772] " redi at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-03 16:01 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-04-10 15:48 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 16:01 [Bug libstdc++/104772] New: std::numeric_limits<__float128> should be specialized redi at gcc dot gnu.org
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

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