diff options
author | Joseph Myers <josmyers@redhat.com> | 2025-03-14 15:58:11 +0000 |
---|---|---|
committer | Joseph Myers <josmyers@redhat.com> | 2025-03-14 15:58:11 +0000 |
commit | 409668f6e88b63607e2cea29b3ce2a1c25f04bf1 (patch) | |
tree | 0711db25c83b4f0bb67fd02ceddd707d561f5e33 /sysdeps/unix/sysv/linux/csky | |
parent | c7c4a5906f326f1290b1c2413a83c530564ec4b8 (diff) | |
download | glibc-409668f6e88b63607e2cea29b3ce2a1c25f04bf1.zip glibc-409668f6e88b63607e2cea29b3ce2a1c25f04bf1.tar.gz glibc-409668f6e88b63607e2cea29b3ce2a1c25f04bf1.tar.bz2 |
Implement C23 powr
C23 adds various <math.h> function families originally defined in TS
18661-4. Add the powr functions, which are like pow, but with simpler
handling of special cases (based on exp(y*log(x)), so negative x and
0^0 are domain errors, powers of -0 are always +0 or +Inf never -0 or
-Inf, and 1^+-Inf and Inf^0 are also domain errors, while NaN^0 and
1^NaN are NaN). The test inputs are taken from those for pow, with
appropriate adjustments (including removing all tests that would be
domain errors from those in auto-libm-test-in and adding some more
such tests in libm-test-powr.inc).
The underlying implementation uses __ieee754_pow functions after
dealing with all special cases that need to be handled differently.
It might be a little faster (avoiding a wrapper and redundant checks
for special cases) to have an underlying implementation built
separately for both pow and powr with compile-time conditionals for
special-case handling, but I expect the benefit of that would be
limited given that both functions will end up needing to use the same
logic for computing pow outside of special cases.
My understanding is that powr(negative, qNaN) should raise "invalid":
that the rule on "invalid" for an argument outside the domain of the
function takes precedence over a quiet NaN argument producing a quiet
NaN result with no exceptions raised (for rootn it's explicit that the
0th root of qNaN raises "invalid"). I've raised this on the WG14
reflector to confirm the intent.
Tested for x86_64 and x86, and with build-many-glibcs.py.
Diffstat (limited to 'sysdeps/unix/sysv/linux/csky')
-rw-r--r-- | sysdeps/unix/sysv/linux/csky/libm.abilist | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/csky/libm.abilist b/sysdeps/unix/sysv/linux/csky/libm.abilist index 55f6bfc..ed35c41 100644 --- a/sysdeps/unix/sysv/linux/csky/libm.abilist +++ b/sysdeps/unix/sysv/linux/csky/libm.abilist @@ -895,6 +895,12 @@ GLIBC_2.41 tanpif32 F GLIBC_2.41 tanpif32x F GLIBC_2.41 tanpif64 F GLIBC_2.41 tanpil F +GLIBC_2.42 powr F +GLIBC_2.42 powrf F +GLIBC_2.42 powrf32 F +GLIBC_2.42 powrf32x F +GLIBC_2.42 powrf64 F +GLIBC_2.42 powrl F GLIBC_2.42 rsqrt F GLIBC_2.42 rsqrtf F GLIBC_2.42 rsqrtf32 F |