From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8BB663858294; Mon, 18 Mar 2024 14:05:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BB663858294 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710770724; bh=nqN0wSP22xcDZxrPIsRD+euI4+NRLuUwaFhvbJR5yXA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tKQn4jnfy1E+yQD8S3pkLXcXqoLoDah85iYXhL4KGiuoQVkrFBuqOlk7a3Uh+ombF BcezUUyP5U2uWe/sxD6Idk4grRt3XEtzHxbMnFEBuO8ItlrL3rtnnQ3GF5fGZJ3K2+ gTRuO37/b5YkYqhdjgaEXVTuyGtsklGuAr/GguwU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109758] std::abs(__float128) doesn't support NaN Date: Mon, 18 Mar 2024 14:05:22 +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: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.2 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=3D109758 --- Comment #17 from GCC Commits --- The releases/gcc-12 branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:9f381ebb7211c1359f5de87760148096fcba3357 commit r12-10244-g9f381ebb7211c1359f5de87760148096fcba3357 Author: Jonathan Wakely Date: Wed May 10 12:20:58 2023 +0100 libstdc++: Fix std::abs(__float128) for -NaN and -0.0 [PR109758] The current implementation of this non-standard overload of std::abs incorrectly returns a negative value for negative NaNs and negative zero, because x < 0 is false in both cases. Use fabsl(long double) or fabsf128(_Float128) if those do the right thing. Otherwise, use __builtin_signbit(x) instead of x < 0 to detect negative inputs. This assumes that __builtin_signbit handles __float128 correctly, but that seems to be true for all of GCC, clang and icc. libstdc++-v3/ChangeLog: PR libstdc++/109758 * include/bits/std_abs.h (abs(__float128)): Handle negative NaN and negative zero correctly. * testsuite/26_numerics/headers/cmath/109758.cc: New test. (cherry picked from commit af595613acbd9863198ae69c7b1c9e856bca9e4f)=