From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 69B473858C1F; Wed, 31 May 2023 13:51:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 69B473858C1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685541065; bh=Om8qNkJY/89pHLs+rtWepjz7SDmXGDrqoTvYi6Bvuoo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=E2FRkQtEDesuNl6WJ1/z2+79sH1FkGmKG1cx+1FSLO0FnNZIJGfI0yidD6ZhnHruN U0FibdCa6y41Ke8l3YDuwfAsxbY/42aCXgNNsEnJVWvwfi4fCss41CEEutDysg4D/B tRfAkK0rcynYDDKHmcyAX9JeXXWEjiZQ8OU0YKqE= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/104772] std::numeric_limits<__float128> should be specialized Date: Wed, 31 May 2023 13:51:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104772 --- Comment #8 from Jakub Jelinek --- Dunno. I think you can add support even without any compiler changes, at least if _GLIBCXX_DOUBLE_IS_IEEE_BINARY64: #ifdef __STRICT_ANSI__ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0static=C2=A0_GLIBCXX_CONSTEXPR=C2=A0__f= loat128 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0min()=C2=A0_GLIBCXX_USE_NOEXCEPT =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0{=C2=A0return=C2=A0__extension__=C2=A03= .36210314311209350626267781732175260e-4932Q;=C2=A0} =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0static=C2=A0_GLIBCXX_CONSTEXPR=C2=A0__f= loat128 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0max()=C2=A0_GLIBCXX_USE_NOEXCEPT =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0{=C2=A0return=C2=A0__extension__=C2=A01= .18973149535723176508575932662800702e+4932Q;=C2=A0} =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0static=C2=A0_GLIBCXX_CONSTEXPR=C2=A0__f= loat128 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0epsilon()=C2=A0_GLIBCXX_USE_NOEXCEPT =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0{=C2=A0return=C2=A0__extension__=C2=A01= .92592994438723585305597794258492732e-34Q;=C2=A0} =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0static=C2=A0_GLIBCXX_CONSTEXPR=C2=A0__f= loat128 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0denorm_min()=C2=A0_GLIBCXX_USE_NOEXCEPT =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0{=C2=A0return=C2=A0__extension__=C2=A06= .47517511943802511092443895822764655e-4966Q;=C2=A0} #else static _GLIBCXX_CONSTEXPR __float128 _S_1pm4088 () _GLIBCXX_USE_NOEXCEPT { return __float128 (0x1.0p-1022) * 0x1.0p-1022 * 0x1.0p-1022 * 0x1.0p-1022; } static _GLIBCXX_CONSTEXPR __float128 _S_1pm16352 () _GLIBCXX_USE_NOEXCEPT { return _S_1pm4088 () * _S_1pm4088 () * _S_1pm4088 () * _S_1pm4088 (= ); } static _GLIBCXX_CONSTEXPR __float128 _S_1p4064 () _GLIBCXX_USE_NOEXCEPT { return __float128 (0x1.0p+1016) * 0x1.0p-1016 * 0x1.0p-1016 * 0x1.0p-1016; } static _GLIBCXX_CONSTEXPR __float128 _S_1p16256 () _GLIBCXX_USE_NOEXCEPT { return _S_1p4064 () * _S_1p4064 () * _S_1p4064 () * _S_1p4064 (); } static _GLIBCXX_CONSTEXPR __float128 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0min()=C2=A0_GLIBCXX_USE_NOEXCEPT =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0{=C2=A0return /* 0x1.0p-16382Q */ 0x1.0= p-30 * _S_1pm16352 ();=C2=A0} =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0static=C2=A0_GLIBCXX_CONSTEXPR=C2=A0__f= loat128 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0max()=C2=A0_GLIBCXX_USE_NOEXCEPT =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0{=C2=A0return=C2=A0/* 0x1.fffffffffffff= fffffffffffffffp+16383Q */ (__float128 (0x1.fffffffffffffp+127) + 0x0.fffffffffffffp+75 + 0x0.ffp+23) * _S_1p16256 ();=C2=A0} =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0static=C2=A0_GLIBCXX_CONSTEXPR=C2=A0__f= loat128 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0epsilon()=C2=A0_GLIBCXX_USE_NOEXCEPT =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0{=C2=A0return=C2=A00x1.0p-112;=C2=A0} =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0static=C2=A0_GLIBCXX_CONSTEXPR=C2=A0__f= loat128 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0denorm_min()=C2=A0_GLIBCXX_USE_NOEXCEPT =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0{=C2=A0return=C2=A0/* 0x1.0p-16494Q */ = 0x1.0p-142 * _S_1pm16352 ();=C2=A0} #endif Except that the FE errors in C++98/11/14 modes on the hexadecimal constants. I guess one could replace them with decimal constants (except those in comm= ents of course), but better use explicit double(whatever) to make sure they aren= 't evaluated in higher precision. Anyway, I think the above computations shou= ld (at least assuming the decimal constants map to those hexadecimal ones) alw= ays be exact and so should produce such results in all rounding modes.=