]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Support std::abs for 128-bit integers and floats [PR96710]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 16 May 2025 12:05:51 +0000 (13:05 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 27 May 2025 11:11:43 +0000 (12:11 +0100)
commite0c3066c14ad98d130ddd1183be3caaeea19c63b
treed89f56e019aca6bee8ab5028bab18b12a02425fc
parent351e60095cfaa73b5ac69222d00e0cd4ae5725d4
libstdc++: Support std::abs for 128-bit integers and floats [PR96710]

Currently we only provide std::abs(__int128) and std::abs(__float128)
for non-strict modes, i.e. -std=gnu++NN but not -std=c++NN.

This defines those overloads for strict modes too, as a small step
towards resolving PR 96710 (which will eventually mean that __int128
satisfies the std::integral concept).

libstdc++-v3/ChangeLog:

PR libstdc++/96710
* include/bits/std_abs.h [__SIZEOF_INT128__] (abs(__int128)):
Define.
[_GLIBCXX_USE_FLOAT128] (abs(__float128)): Enable definition for
strict modes.
* testsuite/26_numerics/headers/cmath/82644.cc: Use strict_std
instead of defining __STRICT_ANSI__.
* testsuite/26_numerics/headers/cstdlib/abs128.cc: New test.

Reviewed-by: Tomasz KamiƄski <tkaminsk@redhat.com>
libstdc++-v3/include/bits/std_abs.h
libstdc++-v3/testsuite/26_numerics/headers/cmath/82644.cc
libstdc++-v3/testsuite/26_numerics/headers/cstdlib/abs128.cc [new file with mode: 0644]