diff options
Diffstat (limited to 'math')
| -rw-r--r-- | math/Makefile | 9 | ||||
| -rw-r--r-- | math/Versions | 2 | ||||
| -rw-r--r-- | math/bits/mathcalls.h | 3 | ||||
| -rwxr-xr-x | math/gen-tgmath-tests.py | 1 | ||||
| -rw-r--r-- | math/libm-test-log1p.inc | 12 | ||||
| -rw-r--r-- | math/test-tgmath.c | 12 | ||||
| -rw-r--r-- | math/tgmath.h | 3 | ||||
| -rw-r--r-- | math/w_log1p_template.c | 2 |
8 files changed, 39 insertions, 5 deletions
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 @@ $(foreach t,$(libm-tests-vector),$(objpfx)$(t).c): $(objpfx)test-%.c: type_func=$*; \ type=$${type_func%-*}; \ func=$${type_func##*-}; \ - func_args=$$(grep ALL_RM_TEST libm-test-$$func.inc \ + func_args=$$(grep "ALL_RM_TEST ($$func," libm-test-$$func.inc \ | sed 's/.*RUN_TEST_LOOP_//;s/_.*//'); \ ( \ echo "#include <test-$$type.h>"; \ @@ -1375,7 +1376,7 @@ CFLAGS-s_llrint.c += -fno-builtin-llrintl CFLAGS-s_llround.c += -fno-builtin-llroundl CFLAGS-e_log.c += -fno-builtin-logl CFLAGS-w_log10.c += -fno-builtin-log10l -CFLAGS-w_log1p.c += -fno-builtin-log1pl +CFLAGS-w_log1p.c += -fno-builtin-log1pl -fno-builtin-logp1l CFLAGS-e_log2.c += -fno-builtin-log2l CFLAGS-s_log2p1.c += -fno-builtin-log2p1l CFLAGS-s_logb.c += -fno-builtin-logbl @@ -1501,7 +1502,7 @@ CFLAGS-s_llrint.c += -fno-builtin-llrintf32x -fno-builtin-llrintf64 CFLAGS-s_llround.c += -fno-builtin-llroundf32x -fno-builtin-llroundf64 CFLAGS-e_log.c += -fno-builtin-logf32x -fno-builtin-logf64 CFLAGS-w_log10.c += -fno-builtin-log10f32x -fno-builtin-log10f64 -CFLAGS-w_log1p.c += -fno-builtin-log1pf32x -fno-builtin-log1pf64 +CFLAGS-w_log1p.c += -fno-builtin-log1pf32x -fno-builtin-log1pf64 -fno-builtin-logp1f32x -fno-builtin-logp1f64 CFLAGS-e_log2.c += -fno-builtin-log2f32x -fno-builtin-log2f64 CFLAGS-s_log2p1.c += -fno-builtin-log2p1f32x -fno-builtin-log2p1f64 CFLAGS-s_logb.c += -fno-builtin-logbf32x -fno-builtin-logbf64 @@ -1616,7 +1617,7 @@ CFLAGS-s_llrintf.c += -fno-builtin-llrintf32 CFLAGS-s_llroundf.c += -fno-builtin-llroundf32 CFLAGS-e_logf.c += -fno-builtin-logf32 CFLAGS-w_log10f.c += -fno-builtin-log10f32 -CFLAGS-w_log1pf.c += -fno-builtin-log1pf32 +CFLAGS-w_log1pf.c += -fno-builtin-log1pf32 -fno-builtin-logp1f32 CFLAGS-e_log2f.c += -fno-builtin-log2f32 CFLAGS-s_log2p1f.c += -fno-builtin-log2p1f32 CFLAGS-s_logbf.c += -fno-builtin-logbf32 diff --git a/math/Versions b/math/Versions index 46b9b87010..f6ddd2f4f7 100644 --- a/math/Versions +++ b/math/Versions @@ -642,7 +642,9 @@ libm { GLIBC_2.40 { # Functions not involving _Float64x or _Float128, for all configurations. log2p1; log2p1f; log2p1l; log2p1f32; log2p1f64; log2p1f32x; + logp1; logp1f; logp1l; logp1f32; logp1f64; logp1f32x; # Functions involving _Float64x or _Float128, for some configurations. log2p1f64x; log2p1f128; + logp1f64x; logp1f128; } } diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h index fbfc27a452..40f9cf35f7 100644 --- a/math/bits/mathcalls.h +++ b/math/bits/mathcalls.h @@ -115,6 +115,9 @@ __MATHCALL_VEC (exp10,, (_Mdouble_ __x)); /* Return log2(1 + X). */ __MATHCALL (log2p1,, (_Mdouble_ __x)); + +/* Return log(1 + X). */ +__MATHCALL (logp1,, (_Mdouble_ __x)); #endif #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py index 1131481fad..307b657939 100755 --- a/math/gen-tgmath-tests.py +++ b/math/gen-tgmath-tests.py @@ -744,6 +744,7 @@ class Tests(object): # TS 18661-4 functions. self.add_tests('exp10', 'r', ['r']) self.add_tests('log2p1', 'r', ['r']) + self.add_tests('logp1', 'r', ['r']) # C23 functions. self.add_tests('fmaximum', 'r', ['r', 'r']) self.add_tests('fmaximum_mag', 'r', ['r', 'r']) diff --git a/math/libm-test-log1p.inc b/math/libm-test-log1p.inc index 67ad03f67c..bcac6ffa4c 100644 --- a/math/libm-test-log1p.inc +++ b/math/libm-test-log1p.inc @@ -40,10 +40,22 @@ log1p_test (void) ALL_RM_TEST (log1p, 0, log1p_test_data, RUN_TEST_LOOP_f_f, END); } +#if !TEST_MATHVEC +static void +logp1_test (void) +{ + /* logp1 uses the same test data as log1p. */ + ALL_RM_TEST (logp1, 0, log1p_test_data, RUN_TEST_LOOP_f_f, END); +} +#endif + static void do_test (void) { log1p_test (); +#if !TEST_MATHVEC + logp1_test (); +#endif } /* diff --git a/math/test-tgmath.c b/math/test-tgmath.c index 141e96bd6e..290e9cb19f 100644 --- a/math/test-tgmath.c +++ b/math/test-tgmath.c @@ -48,7 +48,7 @@ volatile int count_cdouble; volatile int count_cfloat; volatile int count_cldouble; -#define NCALLS 160 +#define NCALLS 162 #define NCALLS_INT 4 #define NCCALLS 47 @@ -256,6 +256,7 @@ F(compile_test) (void) a = exp10 (exp10 (x)); b = log2 (log2 (a)); a = log2p1 (log2p1 (x)); + a = logp1 (logp1 (x)); a = pow (pow (x, a), pow (c, b)); b = sqrt (sqrt (a)); a = hypot (hypot (x, b), hypot (c, a)); @@ -370,6 +371,7 @@ F(compile_test) (void) a = exp10 (y); a = log2 (y); a = log2p1 (y); + a = logp1 (y); a = pow (y, y); a = sqrt (y); a = hypot (y, y); @@ -652,6 +654,14 @@ TYPE } TYPE +(F(logp1)) (TYPE x) +{ + ++count; + P (); + return x; +} + +TYPE (F(pow)) (TYPE x, TYPE y) { ++count; diff --git a/math/tgmath.h b/math/tgmath.h index d9ee3e3a17..78fd2f5ae8 100644 --- a/math/tgmath.h +++ b/math/tgmath.h @@ -877,6 +877,9 @@ /* Return log2(1 + X). */ #define log2p1(Val) __TGMATH_UNARY_REAL_ONLY (Val, log2p1) + +/* Return log(1 + X). */ +#define logp1(Val) __TGMATH_UNARY_REAL_ONLY (Val, logp1) #endif diff --git a/math/w_log1p_template.c b/math/w_log1p_template.c index bfdedb0c76..100f2cdcf8 100644 --- a/math/w_log1p_template.c +++ b/math/w_log1p_template.c @@ -33,3 +33,5 @@ M_DECL_FUNC (__w_log1p) (FLOAT x) return M_SUF (__log1p) (x); } declare_mgen_alias (__w_log1p, log1p) +strong_alias (M_SUF (__w_log1p), M_SUF (__w_logp1)) +declare_mgen_alias (__w_logp1, logp1) |
