diff options
55 files changed, 14133 insertions, 7 deletions
@@ -14,7 +14,7 @@ Major new features: functions for float, double, long double, _FloatN and _FloatNx, and a type-generic macro in <tgmath.h>. - - Power and absolute-value functions: powr, rsqrt. + - Power and absolute-value functions: pown, powr, rsqrt. * On Linux, the pthread_gettid_np function has been added. diff --git a/manual/math.texi b/manual/math.texi index 7490693c0d..adbe271f36 100644 --- a/manual/math.texi +++ b/manual/math.texi @@ -789,6 +789,20 @@ but this is valid for @code{pow} if @var{power} is an integer. The @code{powr} functions are from TS 18661-4:2015. @end deftypefun +@deftypefun double pown (double @var{base}, long long int @var{power}) +@deftypefunx float pownf (float @var{base}, long long int @var{power}) +@deftypefunx {long double} pownl (long double @var{base}, long long int @var{power}) +@deftypefunx _FloatN pownfN (_Float@var{N} @var{base}, long long int @var{power}) +@deftypefunx _FloatNx pownfNx (_Float@var{N}x @var{base}, long long int @var{power}) +@standards{TS 18661-4:2015, math.h} +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} +These return @var{base} raised to @var{power} (an integer). + +The @code{pown} functions are from TS 18661-4:2015 (which used +@code{intmax_t} as the type of @var{power}; the type changed to +@code{long long int} in C23). +@end deftypefun + @cindex square root function @deftypefun double sqrt (double @var{x}) @deftypefunx float sqrtf (float @var{x}) diff --git a/math/Makefile b/math/Makefile index 64d9d4d1e5..6b2331d146 100644 --- a/math/Makefile +++ b/math/Makefile @@ -139,6 +139,7 @@ gen-libm-calls = \ s_log2p1F \ s_nanF \ s_nextdownF \ + s_pownF \ s_powrF \ s_rsqrtF \ s_significandF \ @@ -686,6 +687,7 @@ libm-test-funcs-auto = \ log1p \ log2p1 \ pow \ + pown \ powr \ rsqrt \ sin \ @@ -1018,6 +1020,7 @@ tgmath3-macros = \ nexttoward \ nextup \ pow \ + pown \ powr \ remainder \ remquo \ @@ -1442,6 +1445,7 @@ CFLAGS-s_nexttoward.c += -fno-builtin-nexttoward -fno-builtin-nexttowardl CFLAGS-s_nexttowardf.c += -fno-builtin-nexttowardf CFLAGS-s_nextup.c += -fno-builtin-nextupl CFLAGS-e_pow.c += -fno-builtin-powl +CFLAGS-s_pown.c += -fno-builtin-pownl CFLAGS-s_powr.c += -fno-builtin-powrl CFLAGS-w_remainder.c += -fno-builtin-remainderl -fno-builtin-dreml CFLAGS-s_remquo.c += -fno-builtin-remquol @@ -1578,6 +1582,7 @@ CFLAGS-s_nextafter.c += -fno-builtin-nextafterf32x -fno-builtin-nextafterf64 CFLAGS-s_nextdown.c += -fno-builtin-nextdownf32x -fno-builtin-nextdownf64 CFLAGS-s_nextup.c += -fno-builtin-nextupf32x -fno-builtin-nextupf64 CFLAGS-e_pow.c += -fno-builtin-powf32x -fno-builtin-powf64 +CFLAGS-s_pown.c += -fno-builtin-pownf32x -fno-builtin-pownf64 CFLAGS-s_powr.c += -fno-builtin-powrf32x -fno-builtin-powrf64 CFLAGS-w_remainder.c += -fno-builtin-remainderf32x -fno-builtin-remainderf64 CFLAGS-s_remquo.c += -fno-builtin-remquof32x -fno-builtin-remquof64 @@ -1705,6 +1710,7 @@ CFLAGS-s_nextafterf.c += -fno-builtin-nextafterf32 CFLAGS-s_nextdownf.c += -fno-builtin-nextdownf32 CFLAGS-s_nextupf.c += -fno-builtin-nextupf32 CFLAGS-e_powf.c += -fno-builtin-powf32 +CFLAGS-s_pownf.c += -fno-builtin-pownf32 CFLAGS-s_powrf.c += -fno-builtin-powrf32 CFLAGS-w_remainderf.c += -fno-builtin-remainderf32 CFLAGS-s_remquof.c += -fno-builtin-remquof32 diff --git a/math/Versions b/math/Versions index f92707545a..36c0f23da6 100644 --- a/math/Versions +++ b/math/Versions @@ -673,9 +673,11 @@ libm { } GLIBC_2.42 { # Functions not involving _Float64x or _Float128, for all configurations. + pown; pownf; pownl; pownf32; pownf64; pownf32x; powr; powrf; powrl; powrf32; powrf64; powrf32x; rsqrt; rsqrtf; rsqrtl; rsqrtf32; rsqrtf64; rsqrtf32x; # Functions involving _Float64x or _Float128, for some configurations. + pownf64x; pownf128; powrf64x; powrf128; rsqrtf64x; rsqrtf128; } diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in index cb5d6443b1..7cb8a896ab 100644 --- a/math/auto-libm-test-in +++ b/math/auto-libm-test-in @@ -8151,6 +8151,383 @@ pow 0x1.059c76p+0 0x1.ff80bep+11 pow 0x1.7ac7cp+5 23 pow -0x1.7ac7cp+5 23 +pown 0 0 +pown 0 -0 +pown -0 0 +pown -0 -0 + +pown 10 0 +pown 10 -0 +pown -10 0 +pown -10 -0 + +pown 1 1 +pown 1 -1 +pown 1 0x4fffffffffffffff + +# pown (x, +-0) == 1. +pown 32.75 0 +pown 32.75 -0 +pown -32.75 0 +pown -32.75 -0 +pown 0x1p72 0 +pown 0x1p72 -0 +pown 0x1p-72 0 +pown 0x1p-72 -0 + +pown 0 1 +pown 0 11 + +pown -0 1 +pown -0 11 + +pown 0 2 + +pown -0 2 + +# pown (+0, y) == +0 for y an odd integer > 0. +pown 0.0 27 +pown 0.0 0xffffff +pown 0.0 0x1fffffffffffff + +# pown (-0, y) == -0 for y an odd integer > 0. +pown -0 27 +pown -0 0xffffff +pown -0 0x1fffffe +pown -0 0x1fffffffffffff +pown -0 0x3ffffffffffffe +pown -0 0x7fffffffffffffff + +# pown (+0, y) == +0 for y > 0 and not an odd integer. +pown 0.0 4 +pown 0.0 0x1000000 + +# pown (-0, y) == +0 for y > 0 and not an odd integer. +pown -0 4 +pown -0 0x1000000 + +pown 2 4 +pown 256 8 + +pown -1.0 -0xffffff +pown -1.0 -0x1fffffe +pown -1.0 -0x1fffffffffffff +pown -1.0 -0x3ffffffffffffe +pown -1.0 -0x7fffffffffffffff + +pown -1.0 0xffffff +pown -1.0 0x1fffffe +pown -1.0 0x1fffffffffffff +pown -1.0 0x3ffffffffffffe +pown -1.0 0x7fffffffffffffff + +pown -2.0 126 +pown -2.0 127 +pown -2.0 -126 +pown -2.0 -127 + +pown -2.0 -0xffffff +pown -2.0 -0x1fffffe +pown -2.0 -0x1fffffffffffff +pown -2.0 -0x3ffffffffffffe +pown -2.0 -0x7fffffffffffffff + +pown -2.0 0xffffff +pown -2.0 0x1fffffe +pown -2.0 0x1fffffffffffff +pown -2.0 0x3ffffffffffffe +pown -2.0 0x7fffffffffffffff + +pown -max -2 +pown -max -3 +pown -max 2 +pown -max 3 + +pown -max -0xffffff +pown -max -0x1fffffe +pown -max -0x1fffffffffffff +pown -max -0x3ffffffffffffe +pown -max -0x7fffffffffffffff + +pown -max 0xffffff +pown -max 0x1fffffe +pown -max 0x1fffffffffffff +pown -max 0x3ffffffffffffe +pown -max 0x7fffffffffffffff + +pown -0x1p65 2 +pown -0x1p65 3 +pown -0x1p65 4 +pown -0x1p65 5 +pown -0x1p43 3 +pown -0x1p43 4 +pown -0x1p43 5 +pown -0x1p33 4 +pown -0x1p33 5 +pown -0x1p26 5 +pown -0x1p-65 -2 +pown -0x1p-65 -3 +pown -0x1p-65 -4 +pown -0x1p-65 -5 +pown -0x1p-43 -3 +pown -0x1p-43 -4 +pown -0x1p-43 -5 +pown -0x1p-33 -4 +pown -0x1p-33 -5 +pown -0x1p-26 -5 + +pown -0x1p513 2 +pown -0x1p513 3 +pown -0x1p513 4 +pown -0x1p513 5 +pown -0x1p342 3 +pown -0x1p342 4 +pown -0x1p342 5 +pown -0x1p257 4 +pown -0x1p257 5 +pown -0x1p205 5 +pown -0x1p-513 -2 +pown -0x1p-513 -3 +pown -0x1p-513 -4 +pown -0x1p-513 -5 +pown -0x1p-342 -3 +pown -0x1p-342 -4 +pown -0x1p-342 -5 +pown -0x1p-257 -4 +pown -0x1p-257 -5 +pown -0x1p-205 -5 + +pown -0x1p8192 2 +pown -0x1p8192 3 +pown -0x1p8192 4 +pown -0x1p8192 5 +pown -0x1p5462 3 +pown -0x1p5462 4 +pown -0x1p5462 5 +pown -0x1p4097 4 +pown -0x1p4097 5 +pown -0x1p3277 5 +pown -0x1p64 257 +pown -0x1p-8192 -2 +pown -0x1p-8192 -3 +pown -0x1p-8192 -4 +pown -0x1p-8192 -5 +pown -0x1p-5462 -3 +pown -0x1p-5462 -4 +pown -0x1p-5462 -5 +pown -0x1p-4097 -4 +pown -0x1p-4097 -5 +pown -0x1p-3277 -5 +pown -0x1p-64 -257 + +pown -0.5 126 +pown -0.5 127 +pown -0.5 -126 +pown -0.5 -127 + +pown -0.5 -0xffffff +pown -0.5 -0x1fffffe +pown -0.5 -0x1fffffffffffff +pown -0.5 -0x3ffffffffffffe +pown -0.5 -0x7fffffffffffffff + +pown -0.5 0xffffff +pown -0.5 0x1fffffe +pown -0.5 0x1fffffffffffff +pown -0.5 0x3ffffffffffffe +pown -0.5 0x7fffffffffffffff + +pown -min -2 +pown -min -3 +pown -min 1 +pown -min 2 +pown -min 3 + +pown -min -0xffffff +pown -min -0x1fffffe +pown -min -0x1fffffffffffff +pown -min -0x3ffffffffffffe +pown -min -0x7fffffffffffffff + +pown -min 0xffffff +pown -min 0x1fffffe +pown -min 0x1fffffffffffff +pown -min 0x3ffffffffffffe +pown -min 0x7fffffffffffffff + +pown 0x0.ffffffp0 10 +pown 0x0.ffffffp0 100 +pown 0x0.ffffffp0 1000 +pown 0x0.ffffffp0 0x1000000 +pown 0x0.ffffffp0 0x40000000 +pown 0x0.ffffffp0 0x48d15980 +pown 0x0.ffffffp0 -10 +pown 0x0.ffffffp0 -100 +pown 0x0.ffffffp0 -1000 +pown 0x0.ffffffp0 -0x1000000 +pown 0x0.ffffffp0 -0x40000000 +pown 0x0.ffffffp0 -0x48d15980 +pown 0x1.000002p0 0x1000000 +pown 0x1.000002p0 0x2468acc0 +pown 0x1.000002p0 -0x2468acc0 + +pown 0x0.fffffffffffff8p0 0x48d159e26af37c00 +pown 0x0.fffffffffffff8p0 -0x48d159e26af37c00 +pown 0x1.0000000000001p0 0x2468acf13579be00 +pown 0x1.0000000000001p0 -0x2468acf13579be00 + +pown -0x0.ffffffp0 10 +pown -0x0.ffffffp0 100 +pown -0x0.ffffffp0 1000 +pown -0x0.ffffffp0 0x1000000 +pown -0x0.ffffffp0 0x40000000 +pown -0x0.ffffffp0 0x48d15980 +pown -0x0.ffffffp0 -10 +pown -0x0.ffffffp0 -100 +pown -0x0.ffffffp0 -1000 +pown -0x0.ffffffp0 -0x1000000 +pown -0x0.ffffffp0 -0x40000000 +pown -0x0.ffffffp0 -0x48d15980 +pown -0x1.000002p0 0x1000000 +pown -0x1.000002p0 0x2468acc0 +pown -0x1.000002p0 -0x2468acc0 + |
