aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <josmyers@redhat.com>2024-06-17 13:47:09 +0000
committerJoseph Myers <josmyers@redhat.com>2024-06-17 13:47:09 +0000
commitbb014f50c4a0c8d8db1ba5af55c104e430b5533d (patch)
treea1ca91748bb999691442701c3b786ebc3372114f
parentca38eff28015f376c020b4dfad5351e45be8d090 (diff)
downloadglibc-bb014f50c4a0c8d8db1ba5af55c104e430b5533d.tar.xz
glibc-bb014f50c4a0c8d8db1ba5af55c104e430b5533d.zip
Implement C23 logp1
C23 adds various <math.h> function families originally defined in TS 18661-4. Add the logp1 functions (aliases for log1p functions - the name is intended to be more consistent with the new log2p1 and log10p1, where clearly it would have been very confusing to name those functions log21p and log101p). As aliases rather than new functions, the content of this patch is somewhat different from those actually adding new functions. Tests are shared with log1p, so this patch *does* mechanically update all affected libm-test-ulps files to expect the same errors for both functions. The vector versions of log1p on aarch64 and x86_64 are *not* updated to have logp1 aliases (and thus there are no corresponding header, tests, abilist or ulps changes for vector functions either). It would be reasonable for such vector aliases and corresponding changes to other files to be made separately. For now, the log1p tests instead avoid testing logp1 in the vector case (a Makefile change is needed to avoid problems with grep, used in generating the .c files for vector function tests, matching more than one ALL_RM_TEST line in a file testing multiple functions with the same inputs, when it assumes that the .inc file only has a single such line). Tested for x86_64 and x86, and with build-many-glibcs.py.
-rw-r--r--NEWS2
-rw-r--r--manual/math.texi12
-rw-r--r--math/Makefile9
-rw-r--r--math/Versions2
-rw-r--r--math/bits/mathcalls.h3
-rwxr-xr-xmath/gen-tgmath-tests.py1
-rw-r--r--math/libm-test-log1p.inc12
-rw-r--r--math/test-tgmath.c12
-rw-r--r--math/tgmath.h3
-rw-r--r--math/w_log1p_template.c2
-rw-r--r--sysdeps/aarch64/libm-test-ulps20
-rw-r--r--sysdeps/alpha/fpu/libm-test-ulps20
-rw-r--r--sysdeps/arc/fpu/libm-test-ulps16
-rw-r--r--sysdeps/arc/nofpu/libm-test-ulps4
-rw-r--r--sysdeps/arm/libm-test-ulps16
-rw-r--r--sysdeps/csky/fpu/libm-test-ulps16
-rw-r--r--sysdeps/csky/nofpu/libm-test-ulps16
-rw-r--r--sysdeps/hppa/fpu/libm-test-ulps16
-rw-r--r--sysdeps/i386/fpu/libm-test-ulps23
-rw-r--r--sysdeps/i386/i686/fpu/multiarch/libm-test-ulps23
-rw-r--r--sysdeps/ieee754/float128/Makefile2
-rw-r--r--sysdeps/ieee754/float128/float128_private.h1
-rw-r--r--sysdeps/ieee754/ldbl-128/Makefile2
-rw-r--r--sysdeps/ieee754/ldbl-128ibm-compat/Versions1
-rw-r--r--sysdeps/ieee754/ldbl-96/Makefile2
-rw-r--r--sysdeps/ieee754/ldbl-opt/Makefile2
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-log1p.c1
-rw-r--r--sysdeps/loongarch/lp64/libm-test-ulps20
-rw-r--r--sysdeps/m68k/coldfire/fpu/libm-test-ulps3
-rw-r--r--sysdeps/mach/hurd/i386/libm.abilist8
-rw-r--r--sysdeps/mach/hurd/x86_64/libm.abilist8
-rw-r--r--sysdeps/microblaze/libm-test-ulps4
-rw-r--r--sysdeps/mips/mips32/libm-test-ulps16
-rw-r--r--sysdeps/mips/mips64/libm-test-ulps20
-rw-r--r--sysdeps/nios2/libm-test-ulps4
-rw-r--r--sysdeps/or1k/fpu/libm-test-ulps16
-rw-r--r--sysdeps/or1k/nofpu/libm-test-ulps16
-rw-r--r--sysdeps/powerpc/fpu/libm-test-ulps24
-rw-r--r--sysdeps/powerpc/nofpu/libm-test-ulps20
-rw-r--r--sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile2
-rw-r--r--sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirects.h4
-rw-r--r--sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc.h4
-rw-r--r--sysdeps/powerpc/powerpc64/le/fpu/multiarch/math-type-macros-float128.h2
-rw-r--r--sysdeps/riscv/nofpu/libm-test-ulps20
-rw-r--r--sysdeps/riscv/rvd/libm-test-ulps20
-rw-r--r--sysdeps/s390/fpu/libm-test-ulps20
-rw-r--r--sysdeps/sh/libm-test-ulps8
-rw-r--r--sysdeps/sparc/fpu/libm-test-ulps20
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/alpha/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/arc/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/arm/be/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/arm/le/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/csky/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/hppa/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/i386/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/microblaze/be/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/microblaze/le/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/nios2/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/or1k/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist9
-rw-r--r--sysdeps/unix/sysv/linux/riscv/rv32/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/sh/be/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/sh/le/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/64/libm.abilist8
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist8
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps24
80 files changed, 725 insertions, 12 deletions
diff --git a/NEWS b/NEWS
index 20e263f581..c5fbdc6138 100644
--- a/NEWS
+++ b/NEWS
@@ -26,7 +26,7 @@ Major new features:
functions for float, double, long double, _FloatN and _FloatNx, and a
type-generic macro in <tgmath.h>.
- - Logarithmic functions: log2p1.
+ - Logarithmic functions: log2p1, logp1.
* A new tunable, glibc.rtld.enable_secure, used to run a program
as if it were a setuid process. This is currently a testing tool to allow
diff --git a/manual/math.texi b/manual/math.texi
index c99501ccb1..56f2295cfd 100644
--- a/manual/math.texi
+++ b/manual/math.texi
@@ -745,13 +745,25 @@ to subtraction of two numbers that are nearly equal.
@deftypefunx {long double} log1pl (long double @var{x})
@deftypefunx _FloatN log1pfN (_Float@var{N} @var{x})
@deftypefunx _FloatNx log1pfNx (_Float@var{N}x @var{x})
+@deftypefunx double logp1 (double @var{x})
+@deftypefunx float logp1f (float @var{x})
+@deftypefunx {long double} logp1l (long double @var{x})
+@deftypefunx _FloatN logp1fN (_Float@var{N} @var{x})
+@deftypefunx _FloatNx logp1fNx (_Float@var{N}x @var{x})
@standards{ISO, math.h}
@standardsx{log1pfN, TS 18661-3:2015, math.h}
@standardsx{log1pfNx, TS 18661-3:2015, math.h}
+@standardsx{logp1, TS 18661-4:2015, math.h}
+@standardsx{logp1f, TS 18661-4:2015, math.h}
+@standardsx{logp1l, TS 18661-4:2015, math.h}
+@standardsx{logp1fN, TS 18661-4:2015, math.h}
+@standardsx{logp1fNx, TS 18661-4:2015, math.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
These functions return a value equivalent to @w{@code{log (1 + @var{x})}}.
They are computed in a way that is accurate even if @var{x} is
near zero.
+
+The @code{logp1} names for these functions are from TS 18661-4:2015.
@end deftypefun
@deftypefun double log2p1 (double @var{x})
diff --git a/math/Makefile b/math/Makefile
index 58e5c070cf..c55976cba8 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -966,6 +966,7 @@ tgmath3-macros = \
log2 \
log2p1 \
logb \
+ logp1 \
lrint \
lround \
nearbyint \
@@ -1145,7 +1146,7 @@ $(f