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

--- Comment #15 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
<r...@gcc.gnu.org>:

https://gcc.gnu.org/g:099d469df67d8454aa393d036f4791912364bd4d

commit r13-7406-g099d469df67d8454aa393d036f4791912364bd4d
Author: Jonathan Wakely <jwak...@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.

    (cherry picked from commit af595613acbd9863198ae69c7b1c9e856bca9e4f)

Reply via email to