public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109758] std::abs(__float128) doesn't support NaN Date: Thu, 11 May 2023 11:55:15 +0000 [thread overview] Message-ID: <bug-109758-4-Fj83U5YzIn@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109758-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109758 --- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>: https://gcc.gnu.org/g:af595613acbd9863198ae69c7b1c9e856bca9e4f commit r14-700-gaf595613acbd9863198ae69c7b1c9e856bca9e4f Author: Jonathan Wakely <jwakely@redhat.com> 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.
next prev parent reply other threads:[~2023-05-11 11:55 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-06 17:44 [Bug libquadmath/109758] New: quadmath abs g.peterhoff@t-online.de 2023-05-06 20:33 ` [Bug libstdc++/109758] " jakub at gcc dot gnu.org 2023-05-06 22:15 ` [Bug libstdc++/109758] std::abs(__float128) doesn't support NaN redi at gcc dot gnu.org 2023-05-06 22:48 ` g.peterhoff@t-online.de 2023-05-06 22:57 ` redi at gcc dot gnu.org 2023-05-06 23:06 ` g.peterhoff@t-online.de 2023-05-06 23:09 ` redi at gcc dot gnu.org 2023-05-07 0:09 ` g.peterhoff@t-online.de 2023-05-07 10:04 ` jakub at gcc dot gnu.org 2023-05-08 8:29 ` redi at gcc dot gnu.org 2023-05-08 8:31 ` redi at gcc dot gnu.org 2023-05-08 8:47 ` jakub at gcc dot gnu.org 2023-05-08 16:40 ` redi at gcc dot gnu.org 2023-05-11 11:55 ` cvs-commit at gcc dot gnu.org [this message] 2023-05-11 11:57 ` redi at gcc dot gnu.org 2023-05-11 12:12 ` redi at gcc dot gnu.org 2023-06-01 22:44 ` cvs-commit at gcc dot gnu.org 2023-06-01 22:45 ` redi at gcc dot gnu.org 2024-03-18 14:05 ` cvs-commit at gcc dot gnu.org 2024-03-18 14:12 ` redi 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-109758-4-Fj83U5YzIn@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: linkBe 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).