* [PATCH 00/11] Add more CORE-math implementations to libm
@ 2024-11-11 13:45 Adhemerval Zanella
2024-11-11 13:45 ` [PATCH 01/11] benchtests: Add cbrtf benchmark Adhemerval Zanella
` (10 more replies)
0 siblings, 11 replies; 34+ messages in thread
From: Adhemerval Zanella @ 2024-11-11 13:45 UTC (permalink / raw)
To: libc-alpha
This patchset adds the optimized and correctly rounded cbrtf,
erff, erfcf, lgammaf, and tanf. Each implementation has a benchmark
to evaluate the performance improvements.
I tested the implementation on recent hardware (Ryzen 9 5900X for
x86_64, Ampere/Neoverse for aarch64, POWER10 for powerpc, and
Loongson-3C5000L-LL for loongarch), and all implementations show good
performance improvements. Like the implementation from ARM optimized
routines, the CORE-MATH one takes advantage of recent ISA and platform
support (like FMA and rounding instructions, along with FP throughput).
Adhemerval Zanella (11):
benchtests: Add cbrtf benchmark
benchtests: Add erff benchmark
benchtests: Add erfcf benchmark
benchtests: Add lgammaf benchmark
benchtests: Add tanf benchmark
math: Use cbrtf from CORE-MATH
math: Split s_erfF in erff and erfc
math: Use erff from CORE-MATH
math: Use erfcf from CORE-MATH
math: Use lgammaf from CORE-MATH
math: Use tanf from CORE-MATH
SHARED-FILES | 26 +
benchtests/Makefile | 5 +
benchtests/cbrtf-inputs | 1005 ++++++
benchtests/erfcf-inputs | 795 +++++
benchtests/erff-inputs | 795 +++++
benchtests/lgammaf-inputs | 1005 ++++++
benchtests/tanf-inputs | 3005 +++++++++++++++++
math/Makefile | 1 +
sysdeps/aarch64/libm-test-ulps | 13 -
sysdeps/alpha/fpu/libm-test-ulps | 20 -
sysdeps/arc/fpu/libm-test-ulps | 20 -
sysdeps/arc/nofpu/libm-test-ulps | 7 -
sysdeps/arm/libm-test-ulps | 22 -
sysdeps/csky/fpu/libm-test-ulps | 22 -
sysdeps/csky/nofpu/libm-test-ulps | 22 -
sysdeps/generic/math_int128.h | 144 +
sysdeps/hppa/fpu/libm-test-ulps | 20 -
sysdeps/i386/fpu/libm-test-ulps | 16 -
.../i386/i686/fpu/multiarch/libm-test-ulps | 13 -
sysdeps/ieee754/dbl-64/s_erfc.c | 1 +
sysdeps/ieee754/float128/s_erfcf128.c | 1 +
sysdeps/ieee754/flt-32/e_lgammaf_r.c | 576 ++--
sysdeps/ieee754/flt-32/k_tanf.c | 102 +-
sysdeps/ieee754/flt-32/lgamma_negf.c | 283 +-
sysdeps/ieee754/flt-32/s_cbrtf.c | 136 +-
sysdeps/ieee754/flt-32/s_erfcf.c | 185 +
sysdeps/ieee754/flt-32/s_erff.c | 470 +--
sysdeps/ieee754/flt-32/s_tanf.c | 220 +-
sysdeps/ieee754/ldbl-128/s_erfcl.c | 1 +
sysdeps/ieee754/ldbl-128ibm/s_erfcl.c | 1 +
sysdeps/ieee754/ldbl-96/s_erfcl.c | 1 +
sysdeps/loongarch/lp64/libm-test-ulps | 20 -
sysdeps/m68k/coldfire/fpu/libm-test-ulps | 1 -
sysdeps/m68k/m680x0/fpu/libm-test-ulps | 16 -
sysdeps/microblaze/libm-test-ulps | 7 -
sysdeps/mips/mips32/libm-test-ulps | 22 -
sysdeps/mips/mips64/libm-test-ulps | 20 -
sysdeps/nios2/libm-test-ulps | 7 -
sysdeps/or1k/fpu/libm-test-ulps | 22 -
sysdeps/or1k/nofpu/libm-test-ulps | 22 -
sysdeps/powerpc/fpu/libm-test-ulps | 20 -
sysdeps/powerpc/nofpu/libm-test-ulps | 20 -
sysdeps/riscv/nofpu/libm-test-ulps | 20 -
sysdeps/riscv/rvd/libm-test-ulps | 20 -
sysdeps/s390/fpu/libm-test-ulps | 20 -
sysdeps/sh/libm-test-ulps | 12 -
sysdeps/sparc/fpu/libm-test-ulps | 20 -
sysdeps/x86_64/fpu/libm-test-ulps | 20 -
48 files changed, 7815 insertions(+), 1407 deletions(-)
create mode 100644 benchtests/cbrtf-inputs
create mode 100644 benchtests/erfcf-inputs
create mode 100644 benchtests/erff-inputs
create mode 100644 benchtests/lgammaf-inputs
create mode 100644 benchtests/tanf-inputs
create mode 100644 sysdeps/generic/math_int128.h
create mode 100644 sysdeps/ieee754/dbl-64/s_erfc.c
create mode 100644 sysdeps/ieee754/float128/s_erfcf128.c
create mode 100644 sysdeps/ieee754/flt-32/s_erfcf.c
create mode 100644 sysdeps/ieee754/ldbl-128/s_erfcl.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm/s_erfcl.c
create mode 100644 sysdeps/ieee754/ldbl-96/s_erfcl.c
--
2.43.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 01/11] benchtests: Add cbrtf benchmark
2024-11-11 13:45 [PATCH 00/11] Add more CORE-math implementations to libm Adhemerval Zanella
@ 2024-11-11 13:45 ` Adhemerval Zanella
2024-11-20 21:35 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 02/11] benchtests: Add erff benchmark Adhemerval Zanella
` (9 subsequent siblings)
10 siblings, 1 reply; 34+ messages in thread
From: Adhemerval Zanella @ 2024-11-11 13:45 UTC (permalink / raw)
To: libc-alpha
Based on binary64 benchtests, with random inputs in [1,8].
---
benchtests/Makefile | 1 +
benchtests/cbrtf-inputs | 1005 +++++++++++++++++++++++++++++++++++++++
2 files changed, 1006 insertions(+)
create mode 100644 benchtests/cbrtf-inputs
diff --git a/benchtests/Makefile b/benchtests/Makefile
index d60fe789c8..22698a9853 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -32,6 +32,7 @@ bench-math := \
atan2 \
atanh \
cbrt \
+ cbrtf \
ceil \
ceilf \
cos \
diff --git a/benchtests/cbrtf-inputs b/benchtests/cbrtf-inputs
new file mode 100644
index 0000000000..5a88a1f8dd
--- /dev/null
+++ b/benchtests/cbrtf-inputs
@@ -0,0 +1,1005 @@
+## args: float
+## ret: float
+## includes: math.h
+# Random inputs in [1,8]
+## name: workload-random-1-8
+0x1.e87c26p+0
+0x1.a04bc6p+0
+0x1.e1a296p+0
+0x1.11fe74p+0
+0x1.281292p+0
+0x1.ff4c94p+0
+0x1.6c297ep+0
+0x1.b9491p+0
+0x1.e2c404p+0
+0x1.a90e3ap+0
+0x1.9f7bp+0
+0x1.afc19ep+0
+0x1.e6b212p+0
+0x1.a36142p+0
+0x1.ef229p+0
+0x1.ca7db6p+0
+0x1.7da8cap+0
+0x1.8406f2p+0
+0x1.1f31c4p+0
+0x1.df7f54p+0
+0x1.c77a74p+0
+0x1.b979fcp+0
+0x1.e1dd06p+0
+0x1.9b948ep+0
+0x1.19d17ap+0
+0x1.4d38e6p+0
+0x1.da37cep+0
+0x1.ae037ap+0
+0x1.d9b10cp+0
+0x1.ac2096p+0
+0x1.c9d75ap+0
+0x1.c6149ap+0
+0x1.a5356p+0
+0x1.7fb3e2p+0
+0x1.be7c0ap+0
+0x1.7985c8p+0
+0x1.42ee08p+0
+0x1.800074p+0
+0x1.c88bb6p+0
+0x1.479cb4p+0
+0x1.93b3c8p+0
+0x1.3e7aeap+0
+0x1.2d596ap+0
+0x1.aacb26p+0
+0x1.041bcp+0
+0x1.aacf34p+0
+0x1.d10774p+0
+0x1.a40db6p+0
+0x1.472896p+0
+0x1.d2b388p+0
+0x1.a851f8p+0
+0x1.3ecd52p+0
+0x1.7c8602p+0
+0x1.249842p+0
+0x1.7a9018p+0
+0x1.7c667ep+0
+0x1.221bd4p+0
+0x1.ecd16cp+0
+0x1.19185cp+0
+0x1.8c3abcp+0
+0x1.fd086cp+0
+0x1.86e83ep+0
+0x1.7b1ea2p+0
+0x1.fbedap+0
+0x1.e0772cp+0
+0x1.9fa1b4p+0
+0x1.f96068p+0
+0x1.e61bep+0
+0x1.03d11ap+0
+0x1.a05216p+0
+0x1.a15b5ap+0
+0x1.e6cbf2p+0
+0x1.d96a2ep+0
+0x1.559f72p+0
+0x1.b5e3f6p+0
+0x1.ead2p+0
+0x1.c358ecp+0
+0x1.8dad06p+0
+0x1.e3d814p+0
+0x1.a2f9a4p+0
+0x1.d54f2p+0
+0x1.67a056p+0
+0x1.dd858ap+0
+0x1.e72d8ap+0
+0x1.eb6d7cp+0
+0x1.f2b4dp+0
+0x1.50ff8cp+0
+0x1.0dba38p+0
+0x1.f2739p+0
+0x1.e2360cp+0
+0x1.7cfd92p+0
+0x1.e7b18cp+0
+0x1.b1fe76p+0
+0x1.f636d2p+0
+0x1.8f09b8p+0
+0x1.b2f202p+0
+0x1.fc496cp+0
+0x1.4d20f2p+0
+0x1.f28896p+0
+0x1.f3003ap+0
+0x1.748732p+0
+0x1.7b6e5ap+0
+0x1.2401ccp+0
+0x1.70465cp+0
+0x1.4e658ap+0
+0x1.e1bf66p+0
+0x1.a4291p+0
+0x1.ac3a16p+0
+0x1.e690cp+0
+0x1.6f1434p+0
+0x1.c04402p+0
+0x1.150d2cp+0
+0x1.39f5f6p+0
+0x1.c82e28p+0
+0x1.66cde2p+0
+0x1.430b22p+0
+0x1.f4fff8p+0
+0x1.33de78p+0
+0x1.5e0c8ap+0
+0x1.485b2p+0
+0x1.ad703ap+0
+0x1.ac2082p+0
+0x1.f096d4p+0
+0x1.fc53dcp+0
+0x1.87c4fep+0
+0x1.1d996ep+0
+0x1.e19f66p+0
+0x1.312462p+0
+0x1.e842e2p+0
+0x1.d71d5ep+0
+0x1.ac951p+0
+0x1.fb65fcp+0
+0x1.ae3f7cp+0
+0x1.d7b1dap+0
+0x1.9be56ap+0
+0x1.b3eca2p+0
+0x1.59adcep+0
+0x1.c6c108p+0
+0x1.1c1fb8p+0
+0x1.7374b8p+0
+0x1.f17968p+0
+0x1.91b4a2p+0
+0x1.e8338ep+0
+0x1.38309ap+0
+0x1.f2cc44p+0
+0x1.7fb75cp+0
+0x1.42fbdep+0
+0x1.f61fbap+0
+0x1.b20586p+0
+0x1.173d12p+0
+0x1.0f9596p+0
+0x1.cee8d2p+0
+0x1.b23212p+0
+0x1.d1d3d4p+0
+0x1.caf784p+0
+0x1.97e78ep+0
+0x1.2ffp+0
+0x1.e41806p+0
+0x1.a1ddp+0
+0x1.bf983ap+0
+0x1.f8b902p+0
+0x1.31044ap+0
+0x1.4283ep+0
+0x1.8c4878p+0
+0x1.35ab2ep+0
+0x1.7510eap+0
+0x1.c6e972p+0
+0x1.c99812p+0
+0x1.d6be9ep+0
+0x1.bb7b98p+0
+0x1.b9d56ap+0
+0x1.4d2e0ep+0
+0x1.38cac6p+0
+0x1.a742e2p+0
+0x1.52156cp+0
+0x1.819cf4p+0
+0x1.b8839p+0
+0x1.373082p+0
+0x1.865ffcp+0
+0x1.8460bep+0
+0x1.aedf4p+0
+0x1.55f1bcp+0
+0x1.60c40cp+0
+0x1.d022d6p+0
+0x1.92406ep+0
+0x1.cd77f4p+0
+0x1.91d7a4p+0
+0x1.c12bc8p+0
+0x1.6d00d4p+0
+0x1.546bacp+0
+0x1.843d8ap+0
+0x1.8ae5c4p+0
+0x1.7dc114p+0
+0x1.9c8b62p+0
+0x1.65a7ecp+0
+0x1.22b988p+0
+0x1.697f78p+0
+0x1.52e4b8p+0
+0x1.d45a78p+0
+0x1.b5389p+0
+0x1.35be52p+0
+0x1.6307e8p+0
+0x1.f94bd6p+0
+0x1.c6ffa2p+0
+0x1.8e6daep+0
+0x1.244b2ap+0
+0x1.71cc2p+0
+0x1.ed888cp+0
+0x1.6ab80ep+0
+0x1.908aa2p+0
+0x1.22acap+0
+0x1.626fcap+0
+0x1.a48e2cp+0
+0x1.09c88cp+0
+0x1.d2145cp+0
+0x1.21294ep+0
+0x1.3611d4p+0
+0x1.a6ea1ap+0
+0x1.ef339ap+0
+0x1.0ae964p+0
+0x1.046abep+0
+0x1.64002ep+0
+0x1.50cbc6p+0
+0x1.a0620cp+0
+0x1.af3aecp+0
+0x1.111abep+0
+0x1.1997bp+0
+0x1.7ea8aap+0
+0x1.ad4b76p+0
+0x1.6e1f0cp+0
+0x1.d9e176p+0
+0x1.336c7cp+0
+0x1.4825e2p+0
+0x1.55cca6p+0
+0x1.9f1b54p+0
+0x1.63e694p+0
+0x1.b265d6p+0
+0x1.880192p+0
+0x1.e23208p+0
+0x1.f806f6p+0
+0x1.d46c58p+0
+0x1.b9775cp+0
+0x1.c2dd7ep+0
+0x1.c3ba7cp+0
+0x1.8cad22p+0
+0x1.827836p+0
+0x1.ec7354p+0
+0x1.d74b06p+0
+0x1.dcb3fp+0
+0x1.ecc2bcp+0
+0x1.d284c6p+0
+0x1.882856p+0
+0x1.b15fcp+0
+0x1.1178f6p+0
+0x1.917dbep+0
+0x1.a99522p+0
+0x1.4892ecp+0
+0x1.b4554p+0
+0x1.df131ap+0
+0x1.9f5bfcp+0
+0x1.7c29eep+0
+0x1.a81ab8p+0
+0x1.24fad2p+0
+0x1.b2f3acp+0
+0x1.f6e8aep+0
+0x1.b92974p+0
+0x1.93b1b8p+0
+0x1.cf2ef8p+0
+0x1.5885e6p+0
+0x1.bbb528p+0
+0x1.eada38p+0
+0x1.d05a08p+0
+0x1.338498p+0
+0x1.b637b2p+0
+0x1.be6ff4p+0
+0x1.b86d38p+0
+0x1.0c07b4p+0
+0x1.ecab8ep+0
+0x1.d12336p+0
+0x1.0d4cfep+0
+0x1.b03254p+0
+0x1.985cfcp+0
+0x1.abfc7ap+0
+0x1.03a874p+0
+0x1.dd56aep+0
+0x1.a93216p+0
+0x1.e25e58p+0
+0x1.d0e29ep+0
+0x1.ab28b8p+0
+0x1.95d73ep+0
+0x1.d784eap+0
+0x1.f81bb6p+0
+0x1.bb1042p+0
+0x1.dd85b8p+0
+0x1.4af396p+0
+0x1.a45e0ap+0
+0x1.0bd914p+0
+0x1.b02ac2p+0
+0x1.474756p+0
+0x1.c215bep+0
+0x1.e19002p+0
+0x1.d9e1dep+0
+0x1.142e58p+0
+0x1.34f248p+0
+0x1.2babcep+0
+0x1.99cf08p+0
+0x1.93d698p+0
+0x1.b747bp+0
+0x1.9c1e2ep+0
+0x1.ca8162p+0
+0x1.fae734p+0
+0x1.bd15acp+0
+0x1.eba9ecp+0
+0x1.58e15ap+0
+0x1.3f25ap+0
+0x1.18559ap+0
+0x1.c18ffep+0
+0x1.e6a9ep+0
+0x1.e90cap+0
+0x1.d09bd2p+0
+0x1.977b44p+0
+0x1.c53812p+0
+0x1.2c1dd4p+0
+0x1.e830eap+0
+0x1.236a84p+0
+0x1.cbe1e8p+0
+0x1.0edca4p+0
+0x1.d99012p+0
+0x1.b3956ep+0
+0x1.0e2258p+0
+0x1.79392ep+0
+0x1.af231ep+0
+0x1.313082p+0
+0x1.5269b8p+0
+0x1.828e7ep+0
+0x1.a8f682p+0
+0x1.dc55e2p+0
+0x1.a075e6p+0
+0x1.7b9666p+0
+0x1.aa76e8p+0
+0x1.a70fep+0
+0x1.eeaddcp+0
+0x1.5d25fcp+0
+0x1.e416acp+0
+0x1.e55a3ap+0
+0x1.d3de0ap+0
+0x1.9a576cp+0
+0x1.33ab58p+0
+0x1.775506p+0
+0x1.85b5bp+0
+0x1.e177aap+0
+0x1.c855aap+0
+0x1.fb7584p+0
+0x1.b70d46p+0
+0x1.88dd72p+0
+0x1.c59f4p+0
+0x1.bfaa92p+0
+0x1.d09088p+0
+0x1.d438ap+0
+0x1.10ae74p+0
+0x1.c480dep+0
+0x1.f0ab14p+0
+0x1.e61f84p+0
+0x1.78c6dp+0
+0x1.c988d8p+0
+0x1.e7f77ep+0
+0x1.e07204p+0
+0x1.2e4f16p+0
+0x1.733a4p+0
+0x1.e5768cp+0
+0x1.f2b2e2p+0
+0x1.3de852p+0
+0x1.c49794p+0
+0x1.7d0332p+0
+0x1.420d2cp+0
+0x1.9519dcp+0
+0x1.f167f6p+0
+0x1.dc16b6p+0
+0x1.a1d86cp+0
+0x1.376084p+0
+0x1.98fa12p+0
+0x1.d95128p+0
+0x1.b88b5cp+0
+0x1.c720fep+0
+0x1.e0931cp+0
+0x1.4f33cp+0
+0x1.61653ap+0
+0x1.f5e012p+0
+0x1.e0494p+0
+0x1.74c4e4p+0
+0x1.c59cd4p+0
+0x1.964df4p+0
+0x1.f328a4p+0
+0x1.37a3dcp+0
+0x1.ae8cb6p+0
+0x1.d585c2p+0
+0x1.da197cp+0
+0x1.db237ap+0
+0x1.3b904ap+0
+0x1.7f87f6p+0
+0x1.c4a6f2p+0
+0x1.dab554p+0
+0x1.9f4748p+0
+0x1.88619ep+0
+0x1.fae9f4p+0
+0x1.8c8fdap+0
+0x1.c17b3p+0
+0x1.a0c06ep+0
+0x1.e6f9b4p+0
+0x1.d2571ep+0
+0x1.d735fap+0
+0x1.a1b1aep+0
+0x1.e66a5ap+0
+0x1.f61852p+0
+0x1.8fb5bp+0
+0x1.edecd6p+0
+0x1.d33fcep+0
+0x1.d0ad32p+0
+0x1.d1d8acp+0
+0x1.713a06p+0
+0x1.bade5p+0
+0x1.8018e2p+0
+0x1.7b6d44p+0
+0x1.e11ae8p+0
+0x1.65058ap+0
+0x1.fd5312p+0
+0x1.e19afp+0
+0x1.8b6bd8p+0
+0x1.eff138p+0
+0x1.3715dep+0
+0x1.9153fp+0
+0x1.d57afep+0
+0x1.dd8364p+0
+0x1.a59b42p+0
+0x1.dcb8b2p+0
+0x1.e5188ep+0
+0x1.684394p+0
+0x1.2a63d4p+0
+0x1.2ec2c4p+0
+0x1.3df946p+0
+0x1.0c71c6p+0
+0x1.3bd83cp+0
+0x1.6fa42ap+0
+0x1.eb7006p+0
+0x1.7b9de2p+0
+0x1.c062b2p+0
+0x1.b7c812p+0
+0x1.cb4a34p+0
+0x1.ab536cp+0
+0x1.c930d4p+0
+0x1.619e8cp+0
+0x1.e29f6ep+0
+0x1.55caecp+0
+0x1.625c12p+0
+0x1.eeee74p+0
+0x1.632708p+0
+0x1.fe656cp+0
+0x1.ef6386p+0
+0x1.4c09a4p+0
+0x1.8c76eap+0
+0x1.7d525ep+0
+0x1.d311d8p+0
+0x1.667ab2p+0
+0x1.e58c52p+0
+0x1.521686p+0
+0x1.abc0dep+0
+0x1.de0c6ep+0
+0x1.cb1baap+0
+0x1.bdbcd6p+0
+0x1.6df77ap+0
+0x1.2279c4p+0
+0x1.aa8862p+0
+0x1.4a9982p+0
+0x1.dbfdbcp+0
+0x1.8f36c8p+0
+0x1.b763eep+0
+0x1.e7c1bcp+0
+0x1.f9a1d2p+0
+0x1.c4e05ap+0
+0x1.b100b6p+0
+0x1.139264p+0
+0x1.d96fb4p+0
+0x1.8f8b5cp+0
+0x1.827c5p+0
+0x1.03a624p+0
+0x1.d40e3ap+0
+0x1.820de4p+0
+0x1.5161bp+0
+0x1.326926p+0
+0x1.2e5f5p+0
+0x1.92f152p+0
+0x1.f1cb22p+0
+0x1.0bc29p+0
+0x1.53839p+0
+0x1.58b0ccp+0
+0x1.6b8784p+0
+0x1.4a7332p+0
+0x1.802e84p+0
+0x1.522892p+0
+0x1.8f00b4p+0
+0x1.bf3cf4p+0
+0x1.639096p+0
+0x1.9176cp+0
+0x1.f1effap+0
+0x1.c68312p+0
+0x1.6ad3eep+0
+0x1.d18108p+0
+0x1.f6b95cp+0
+0x1.db91f2p+0
+0x1.66ae04p+0
+0x1.92388p+0
+0x1.af8df6p+0
+0x1.424e0ap+0
+0x1.57fc24p+0
+0x1.11854ap+0
+0x1.86b886p+0
+0x1.103b32p+0
+0x1.80e806p+0
+0x1.2a8792p+0
+0x1.7d7106p+0
+0x1.00728ap+0
+0x1.61683ap+0
+0x1.22d0eap+0
+0x1.e972b6p+0
+0x1.c8888cp+0
+0x1.3e419cp+0
+0x1.5470d6p+0
+0x1.ed059ap+0
+0x1.fc3e74p+0
+0x1.5cb21p+0
+0x1.f55f96p+0
+0x1.d15f3p+0
+0x1.ddfff6p+0
+0x1.a349ep+0
+0x1.da76dap+0
+0x1.c1065p+0
+0x1.eec684p+0
+0x1.fff73ap+0
+0x1.49055ep+0
+0x1.7e28b4p+0
+0x1.fd9dbap+0
+0x1.61027ep+0
+0x1.f1aa7ap+0
+0x1.b277f2p+0
+0x1.7b64f6p+0
+0x1.c45a5ap+0
+0x1.7f66ep+0
+0x1.8ade4ap+0
+0x1.9527acp+0
+0x1.e907eap+0
+0x1.b440bap+0
+0x1.ff324p+0
+0x1.ade4bp+0
+0x1.a1e466p+0
+0x1.d911bp+0
+0x1.b67584p+0
+0x1.a04878p+0
+0x1.123ebcp+0
+0x1.a7cb1p+0
+0x1.a6bdb8p+0
+0x1.1da706p+0
+0x1.b0f4aep+0
+0x1.d7bb14p+0
+0x1.f9bff4p+0
+0x1.e567acp+0
+0x1.71d194p+0
+0x1.dbc0cep+0
+0x1.d759b8p+0
+0x1.e62a1ap+0
+0x1.4bef5p+0
+0x1.653c0cp+0
+0x1.802c9ap+0
+0x1.22e082p+0
+0x1.e11a4ep+0
+0x1.5073d6p+0
+0x1.12450cp+0
+0x1.d7be58p+0
+0x1.ea0c24p+0
+0x1.e1954ep+0
+0x1.6f1578p+0
+0x1.61b49p+0
+0x1.154f86p+0
+0x1.62bd82p+0
+0x1.889ea6p+0
+0x1.7e8426p+0
+0x1.47913p+0
+0x1.78f0c8p+0
+0x1.91c02p+0
+0x1.c57088p+0
+0x1.c97902p+0
+0x1.e7f5ap+0
+0x1.9ea022p+0
+0x1.84d798p+0
+0x1.d863c4p+0
+0x1.5d0786p+0
+0x1.a10f04p+0
+0x1.71c2fcp+0
+0x1.5775c2p+0
+0x1.53accp+0
+0x1.89361p+0
+0x1.aafc3ep+0
+0x1.0c74c4p+0
+0x1.383a02p+0
+0x1.54c048p+0
+0x1.fb5558p+0
+0x1.da1964p+0
+0x1.c4a29ep+0
+0x1.b06644p+0
+0x1.36812ep+0
+0x1.f536eep+0
+0x1.44e4ecp+0
+0x1.306b28p+0
+0x1.79905cp+0
+0x1.fa719ap+0
+0x1.90d3p+0
+0x1.e1124ep+0
+0x1.b0b768p+0
+0x1.b78aa8p+0
+0x1.9cb40ap+0
+0x1.995f7p+0
+0x1.d9b034p+0
+0x1.69ca9ap+0
+0x1.f47708p+0
+0x1.df29aep+0
+0x1.4daea4p+0
+0x1.d697f6p+0
+0x1.b19498p+0
+0x1.35334ep+0
+0x1.0adecp+0
+0x1.c5ee54p+0
+0x1.ee7e48p+0
+0x1.60a684p+0
+0x1.0f9c78p+0
+0x1.8dee6ap+0
+0x1.dd3a5p+0
+0x1.ca5258p+0
+0x1.b91818p+0
+0x1.1f3efap+0
+0x1.7308eap+0
+0x1.a5460ep+0
+0x1.7c6f6p+0
+0x1.370e9p+0
+0x1.88f37cp+0
+0x1.cff908p+0
+0x1.fab97p+0
+0x1.c65978p+0
+0x1.9361fp+0
+0x1.c8ab7p+0
+0x1.f784c2p+0
+0x1.e5135ap+0
+0x1.b79c8cp+0
+0x1.e690d4p+0
+0x1.4e81cp+0
+0x1.cb87a4p+0
+0x1.6ae27cp+0
+0x1.75b31ep+0
+0x1.a3261p+0
+0x1.46627cp+0
+0x1.d3b61cp+0
+0x1.b62818p+0
+0x1.70e138p+0
+0x1.57f3ccp+0
+0x1.cf281ep+0
+0x1.192e8ap+0
+0x1.d9fbb6p+0
+0x1.860466p+0
+0x1.aceffcp+0
+0x1.0cb786p+0
+0x1.aa06eep+0
+0x1.c53e3p+0
+0x1.266314p+0
+0x1.ee2d5cp+0
+0x1.fb9564p+0
+0x1.c20736p+0
+0x1.a96534p+0
+0x1.a71ceap+0
+0x1.2960e8p+0
+0x1.ca3594p+0
+0x1.acc278p+0
+0x1.873d2ap+0
+0x1.ee50b8p+0
+0x1.3d50e6p+0
+0x1.af1d22p+0
+0x1.e3485p+0
+0x1.8f856cp+0
+0x1.ffbf7ep+0
+0x1.b653fp+0
+0x1.63ddap+0
+0x1.9d478p+0
+0x1.c9c638p+0
+0x1.b2dda4p+0
+0x1.74f284p+0
+0x1.8d06a6p+0
+0x1.d1162p+0
+0x1.d76a6ep+0
+0x1.e48d66p+0
+0x1.90fa98p+0
+0x1.c92b1ap+0
+0x1.b904dap+0
+0x1.f1c4aep+0
+0x1.65eb42p+0
+0x1.773a86p+0
+0x1.f00852p+0
+0x1.c9ed02p+0
+0x1.f6747ap+0
+0x1.da5196p+0
+0x1.bb290ap+0
+0x1.95f264p+0
+0x1.f39a08p+0
+0x1.c8b896p+0
+0x1.c2cf78p+0
+0x1.c79138p+0
+0x1.d3e334p+0
+0x1.f545fcp+0
+0x1.6bfd7cp+0
+0x1.55d26ap+0
+0x1.1dc43cp+0
+0x1.db4f3cp+0
+0x1.f6c8e4p+0
+0x1.7df66ep+0
+0x1.a20738p+0
+0x1.98844ap+0
+0x1.d0257ep+0
+0x1.cf9336p+0
+0x1.c4de54p+0
+0x1.ab0816p+0
+0x1.c3340cp+0
+0x1.15c508p+0
+0x1.14993ep+0
+0x1.e767eap+0
+0x1.ee0bdcp+0
+0x1.cdf566p+0
+0x1.ff63ep+0
+0x1.169174p+0
+0x1.626698p+0
+0x1.aba4a8p+0
+0x1.98afbcp+0
+0x1.d63d8cp+0
+0x1.00e91ep+0
+0x1.cba076p+0
+0x1.2a1b88p+0
+0x1.32e4d4p+0
+0x1.b2c828p+0
+0x1.59e0aap+0
+0x1.79e2f8p+0
+0x1.961fc8p+0
+0x1.7c0e4ap+0
+0x1.ab902p+0
+0x1.487aacp+0
+0x1.9e3388p+0
+0x1.6ad5ap+0
+0x1.e159dep+0
+0x1.bccd0cp+0
+0x1.4d6884p+0
+0x1.614fbp+0
+0x1.8db40ap+0
+0x1.8f813ep+0
+0x1.60d7cp+0
+0x1.d00412p+0
+0x1.c11ab2p+0
+0x1.de5606p+0
+0x1.897acap+0
+0x1.fd24d4p+0
+0x1.ddfb42p+0
+0x1.c7f18ep+0
+0x1.ee7c56p+0
+0x1.c1d018p+0
+0x1.138bbap+0
+0x1.856d4cp+0
+0x1.fb9218p+0
+0x1.e4fa74p+0
+0x1.98d028p+0
+0x1.6debf4p+0
+0x1.8be8bep+0
+0x1.a67e4ep+0
+0x1.744ba2p+0
+0x1.b161b4p+0
+0x1.5ccb08p+0
+0x1.85334cp+0
+0x1.120c5p+0
+0x1.6879c8p+0
+0x1.349fd6p+0
+0x1.f28246p+0
+0x1.99c612p+0
+0x1.1f31e8p+0
+0x1.f676b2p+0
+0x1.648482p+0
+0x1.d180aap+0
+0x1.691bcep+0
+0x1.04c25p+0
+0x1.7fb33ap+0
+0x1.92ee92p+0
+0x1.70481p+0
+0x1.57f064p+0
+0x1.63757ap+0
+0x1.9a2fe8p+0
+0x1.f1d4aap+0
+0x1.c6295ap+0
+0x1.f7ffb6p+0
+0x1.5c8f02p+0
+0x1.513d54p+0
+0x1.f48bap+0
+0x1.b5d5fp+0
+0x1.dcd8c2p+0
+0x1.eaa42ap+0
+0x1.2c974cp+0
+0x1.013e86p+0
+0x1.49b9e4p+0
+0x1.02dac2p+0
+0x1.1153d2p+0
+0x1.26e74ap+0
+0x1.0ff61cp+0
+0x1.9c02eap+0
+0x1.e7afa6p+0
+0x1.189d62p+0
+0x1.f5a70ep+0
+0x1.09b608p+0
+0x1.d46dc6p+0
+0x1.d6249ep+0
+0x1.68c99cp+0
+0x1.861a64p+0
+0x1.2de5e2p+0
+0x1.c7a028p+0
+0x1.a71108p+0
+0x1.c2cc5cp+0
+0x1.03b5bcp+0
+0x1.36f9ccp+0
+0x1.fd014cp+0
+0x1.9a79cp+0
+0x1.040fbap+0
+0x1.f73ca4p+0
+0x1.afacd4p+0
+0x1.defc84p+0
+0x1.f78a3p+0
+0x1.f5a9fcp+0
+0x1.b74c1cp+0
+0x1.e55e9ap+0
+0x1.352a26p+0
+0x1.d874cep+0
+0x1.af77aap+0
+0x1.38bedep+0
+0x1.46ba3p+0
+0x1.e1643cp+0
+0x1.8d1c46p+0
+0x1.6e9ab2p+0
+0x1.86d024p+0
+0x1.d36a56p+0
+0x1.4a5714p+0
+0x1.a162aap+0
+0x1.6aa824p+0
+0x1.be31cp+0
+0x1.f1568ap+0
+0x1.ff49b6p+0
+0x1.fac946p+0
+0x1.9039cap+0
+0x1.2d2518p+0
+0x1.da8cc6p+0
+0x1.2f7ef2p+0
+0x1.9756dap+0
+0x1.150788p+0
+0x1.50ff6p+0
+0x1.8cba12p+0
+0x1.18e17ep+0
+0x1.87d05p+0
+0x1.04da9p+0
+0x1.7de59ap+0
+0x1.9fdb8cp+0
+0x1.47e31ep+0
+0x1.35c432p+0
+0x1.d15936p+0
+0x1.e9e442p+0
+0x1.9adb1cp+0
+0x1.bfd1d4p+0
+0x1.db93cep+0
+0x1.b5e71p+0
+0x1.68b9a8p+0
+0x1.bbf84p+0
+0x1.68211ap+0
+0x1.8047d2p+0
+0x1.f47202p+0
+0x1.eaf4c4p+0
+0x1.8da3dep+0
+0x1.c0ae4cp+0
+0x1.aa522ap+0
+0x1.20afeap+0
+0x1.73cdap+0
+0x1.f6069p+0
+0x1.d8b1a4p+0
+0x1.587p+0
+0x1.a4362cp+0
+0x1.a45bf2p+0
+0x1.2457dap+0
+0x1.26ba58p+0
+0x1.f394a2p+0
+0x1.a303aep+0
+0x1.1b3fb4p+0
+0x1.80e924p+0
+0x1.6bc8e4p+0
+0x1.bf6e8ap+0
+0x1.9b56c6p+0
+0x1.c02a76p+0
+0x1.4e3c9ep+0
+0x1.5aeecap+0
+0x1.9abc9p+0
+0x1.8b692ap+0
+0x1.cc3f58p+0
+0x1.176aaap+0
+0x1.db93f8p+0
+0x1.c6535ap+0
+0x1.d256ap+0
+0x1.8ab6f2p+0
+0x1.9bf8d8p+0
+0x1.c74786p+0
+0x1.68709cp+0
+0x1.73c5f8p+0
+0x1.1a8ebep+0
+0x1.ec27c6p+0
+0x1.2a462ep+0
+0x1.d346cep+0
+0x1.fb486ep+0
+0x1.b3a156p+0
+0x1.922d9ap+0
+0x1.d7e074p+0
+0x1.205202p+0
+0x1.d4ca8ep+0
+0x1.cf4e76p+0
+0x1.3acd2p+0
+0x1.e1c196p+0
+0x1.95367ap+0
+0x1.ec07aep+0
+0x1.13972cp+0
+0x1.554a06p+0
+0x1.5081ecp+0
+0x1.e4e3c8p+0
+0x1.64be3p+0
+0x1.f854dap+0
+0x1.9c1638p+0
+0x1.c75e34p+0
+0x1.ef86fcp+0
+0x1.163d8ep+0
+0x1.bc8afap+0
+0x1.883bp+0
+0x1.9d4502p+0
+0x1.d14ef2p+0
+0x1.b954dcp+0
+0x1.20366p+0
+0x1.8ba9a8p+0
+0x1.e6b654p+0
+0x1.c1cd7ep+0
+0x1.c2e336p+0
+0x1.877d5ap+0
+0x1.f2c3b2p+0
+0x1.c09764p+0
+0x1.f5c456p+0
+0x1.aa5598p+0
+0x1.eaebp+0
+0x1.8f63d2p+0
+0x1.f8656ep+0
+0x1.90cc98p+0
+0x1.eb52f8p+0
+0x1.56019p+0
+0x1.64e72ap+0
+0x1.fec4dp+0
+0x1.3fd562p+0
+0x1.80ae92p+0
+0x1.c4002ep+0
+0x1.614d84p+0
+0x1.e2b426p+0
+0x1.b43c12p+0
+0x1.33162cp+0
+0x1.11a99p+0
+0x1.e8f64ap+0
+0x1.85a1aep+0
+0x1.d6ae38p+0
+0x1.f5a956p+0
+0x1.f06ecep+0
+0x1.d71d42p+0
+0x1.878a7ap+0
+0x1.fdaeccp+0
+0x1.f4e0bap+0
+0x1.5c60f2p+0
+0x1.6d95b6p+0
+0x1.ec7728p+0
+0x1.3781eep+0
+0x1.8ace7ep+0
+0x1.b5e8d8p+0
+0x1.3de912p+0
+0x1.65ea72p+0
+0x1.07f608p+0
+0x1.44a5e8p+0
+0x1.ef8fbap+0
+0x1.e49c96p+0
+0x1.5bab5p+0
+0x1.a0f1a2p+0
+0x1.ca45a2p+0
+0x1.f37492p+0
+0x1.9f0842p+0
+0x1.eebde8p+0
+0x1.889fb4p+0
+0x1.9f3a22p+0
--
2.43.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 02/11] benchtests: Add erff benchmark
2024-11-11 13:45 [PATCH 00/11] Add more CORE-math implementations to libm Adhemerval Zanella
2024-11-11 13:45 ` [PATCH 01/11] benchtests: Add cbrtf benchmark Adhemerval Zanella
@ 2024-11-11 13:45 ` Adhemerval Zanella
2024-11-20 21:38 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 03/11] benchtests: Add erfcf benchmark Adhemerval Zanella
` (8 subsequent siblings)
10 siblings, 1 reply; 34+ messages in thread
From: Adhemerval Zanella @ 2024-11-11 13:45 UTC (permalink / raw)
To: libc-alpha
It is based on binary64 erf-inputs, with random inputs in [0,b=0x1.f5a888p+1]
where b in the smallest number such that erff(b) rounds to 1 (to nearest).
---
benchtests/Makefile | 1 +
benchtests/erff-inputs | 795 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 796 insertions(+)
create mode 100644 benchtests/erff-inputs
diff --git a/benchtests/Makefile b/benchtests/Makefile
index 22698a9853..36b8296958 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -40,6 +40,7 @@ bench-math := \
cosh \
erf \
erfc \
+ erff \
exp \
exp10 \
exp10f \
diff --git a/benchtests/erff-inputs b/benchtests/erff-inputs
new file mode 100644
index 0000000000..499cc83819
--- /dev/null
+++ b/benchtests/erff-inputs
@@ -0,0 +1,795 @@
+## args: float
+## ret: float
+## includes: math.h
+# Random inputs in [0,b=0x1.f5a888p+1]
+# where b in the smallest number such that erff(b) rounds to 1 (to nearest)
+## name: workload-random
+0x1.18bdeap+0
+0x1.a0baaep+1
+0x1.3bea6cp+1
+0x1.5d7642p-2
+0x1.f384dap+0
+0x1.4c5fb8p+1
+0x1.e58292p+0
+0x1.f235b4p+1
+0x1.d0864ap+0
+0x1.c9eaa6p+0
+0x1.7ebbb8p+1
+0x1.4f1886p+1
+0x1.527632p+1
+0x1.bc8684p+0
+0x1.bb42acp+0
+0x1.f83f2ap-1
+0x1.af5eeep+0
+0x1.4ca57p-2
+0x1.30fb92p-2
+0x1.c333eep-1
+0x1.2b19b2p-1
+0x1.6b8d48p-1
+0x1.1abb34p-5
+0x1.399a96p-6
+0x1.4d6a38p-2
+0x1.281754p+0
+0x1.de3624p+1
+0x1.d0e6e4p+0
+0x1.860874p+1
+0x1.ceb926p-1
+0x1.41535ap+1
+0x1.4e977cp+0
+0x1.c0699cp+1
+0x1.c5953p-2
+0x1.0f851cp+1
+0x1.5fe912p+1
+0x1.d1c0ep-5
+0x1.983f12p+1
+0x1.afb2d6p+0
+0x1.1f8d36p+1
+0x1.950f7ap+1
+0x1.5b604p+1
+0x1.82afcap-2
+0x1.870554p+0
+0x1.45e22ap-1
+0x1.fe83e2p+0
+0x1.b1e67ep+1
+0x1.ca2412p+1
+0x1.4252dcp-3
+0x1.cf28a4p+1
+0x1.347f42p-1
+0x1.bc27dap+1
+0x1.f048b4p+0
+0x1.d9f5fp+0
+0x1.075d56p+1
+0x1.dac2dep+0
+0x1.d4b8c8p+1
+0x1.0abfa4p+1
+0x1.a8c8b2p+1
+0x1.e8c7fep+0
+0x1.8c19d6p+1
+0x1.06465ep+1
+0x1.e41f0cp+1
+0x1.cc2bfp+0
+0x1.0dc5a2p+1
+0x1.1910aep-1
+0x1.ee987ep-2
+0x1.2aa2d6p+0
+0x1.255dep+1
+0x1.3c5f6cp+1
+0x1.8f4982p+0
+0x1.3e9b28p+1
+0x1.bd9e1cp-1
+0x1.71dcc4p+0
+0x1.6d19b6p+1
+0x1.cc31aep+1
+0x1.9ee44p+1
+0x1.03ad5ep-2
+0x1.ed9204p+0
+0x1.f3c032p-5
+0x1.3268cep+1
+0x1.2c198cp+1
+0x1.a1b458p-1
+0x1.20d8ccp+1
+0x1.95c75p-1
+0x1.5919b6p+1
+0x1.aef4c4p+1
+0x1.114e5ap+0
+0x1.0f5f62p+0
+0x1.ba566cp+1
+0x1.24edccp+1
+0x1.e2d818p+1
+0x1.5021eap+1
+0x1.9869f4p+0
+0x1.053fdep+1
+0x1.324de8p+1
+0x1.379fcep-2
+0x1.3730c8p-3
+0x1.32a75p+1
+0x1.86adcep+1
+0x1.b4aa84p+1
+0x1.1f2b62p+1
+0x1.21bfe4p-6
+0x1.a51b1ep+1
+0x1.073298p+0
+0x1.d77154p+1
+0x1.59a0b2p+1
+0x1.07bc9cp+1
+0x1.d8577ep+1
+0x1.96587ap+1
+0x1.77f71cp+1
+0x1.cdf78ep+1
+0x1.c6f86ep-1
+0x1.61dc9p+1
+0x1.80340cp+0
+0x1.e1471p+1
+0x1.76733p-1
+0x1.212d24p+0
+0x1.e2a7b4p-2
+0x1.25208ep+0
+0x1.2fbf6p+0
+0x1.a3daf8p-1
+0x1.2882b6p+1
+0x1.e1209ep+1
+0x1.37a90ap-1
+0x1.7cd7acp+0
+0x1.4b4dc8p+1
+0x1.3decf8p+1
+0x1.aad7bep+0
+0x1.cf4796p-1
+0x1.2de694p+0
+0x1.10a15cp+0
+0x1.dce9c6p+1
+0x1.e47718p+1
+0x1.ec1044p+1
+0x1.1279b8p+1
+0x1.68c6e2p+1
+0x1.07517cp-2
+0x1.73674ap+1
+0x1.5bb68p-2
+0x1.5b3414p-1
+0x1.3cd5d6p-2
+0x1.b069b4p+1
+0x1.3cdf3ap-2
+0x1.f7932ap-5
+0x1.3357bp+1
+0x1.af55b6p+1
+0x1.e189f6p+1
+0x1.d81feap+1
+0x1.0d8702p+1
+0x1.d9c8ap+1
+0x1.de49d8p-2
+0x1.4a2eacp-6
+0x1.a7bf2ep+0
+0x1.72abdcp+0
+0x1.183c76p+0
+0x1.69009cp+0
+0x1.37294ap+0
+0x1.911bdep+0
+0x1.304408p-1
+0x1.be4f9ap+0
+0x1.60df3p+0
+0x1.c0025ep-2
+0x1.91831cp-1
+0x1.de68ep+1
+0x1.9d1bf8p-2
+0x1.605accp-3
+0x1.9466b8p+1
+0x1.30e7d2p+1
+0x1.adeb88p-1
+0x1.be9564p+1
+0x1.a3ae6ap+1
+0x1.0bad16p+1
+0x1.ce0ddap+1
+0x1.22fd8p-1
+0x1.fb2daap-1
+0x1.edc37ap+1
+0x1.f8ef0ap+0
+0x1.71c7bcp+0
+0x1.60ddd4p+0
+0x1.6beb28p-4
+0x1.42d09cp-5
+0x1.ef9e2cp+1
+0x1.3a7b96p+1
+0x1.3be378p-2
+0x1.c2043ep+1
+0x1.ab3bd2p+1
+0x1.186ef4p+1
+0x1.490ea4p+0
+0x1.6e16fap-1
+0x1.0a592p+0
+0x1.66c314p+1
+0x1.19e4fp+1
+0x1.1078a4p+0
+0x1.1ece24p+0
+0x1.927f5cp+0
+0x1.9ee168p+0
+0x1.a89ccp+1
+0x1.71b4b6p+1
+0x1.ae1a7p-1
+0x1.aa4beap+0
+0x1.46f0c6p-2
+0x1.6ba02p-1
+0x1.39bf9p+1
+0x1.da2a6ep+0
+0x1.e163eap+1
+0x1.e3200ap+1
+0x1.578452p-2
+0x1.2d62aep+1
+0x1.1a996ap+0
+0x1.da16ecp+1
+0x1.6fab36p+0
+0x1.ecf7fcp+1
+0x1.b5774ap+1
+0x1.73f4dep+0
+0x1.95530ap+1
+0x1.0c11c2p+1
+0x1.82aa7cp-2
+0x1.2fee4p+0
+0x1.15b67cp+0
+0x1.69fe3ap-2
+0x1.e9c74cp+1
+0x1.f18e5cp+1
+0x1.1ad88ap+1
+0x1.2fd69ep-1
+0x1.b20444p+1
+0x1.95cf7p+1
+0x1.993854p+1
+0x1.982b56p-3
+0x1.542086p+1
+0x1.daa528p-1
+0x1.f0b574p+0
+0x1.275892p+1
+0x1.d88506p+1
+0x1.81f2fcp+1
+0x1.9a5b38p+0
+0x1.e040f4p-3
+0x1.35ead2p+1
+0x1.e8720cp-2
+0x1.0fb3b6p+1
+0x1.91634ep+1
+0x1.471eb4p+1
+0x1.ce31b2p+0
+0x1.a31b6ap+0
+0x1.45199p+1
+0x1.88ad2p+1
+0x1.8a6c5ep+1
+0x1.3e3dc4p+0
+0x1.3d37e6p-10
+0x1.7be9eap-1
+0x1.9ae6acp-3
+0x1.8f7068p+0
+0x1.6a3e36p-1
+0x1.72518ep-3
+0x1.a69b2ep+0
+0x1.06f66ep+0
+0x1.4a611ep-7
+0x1.db806p-1
+0x1.4edbdep+1
+0x1.71b822p+1
+0x1.4bcdd2p+1
+0x1.86c9fep+0
+0x1.18d17cp+0
+0x1.bede3ap-2
+0x1.a67d26p+0
+0x1.2a24c8p+0
+0x1.515eaep+0
+0x1.b09292p+0
+0x1.ac617cp-1
+0x1.f489a4p+1
+0x1.c7d8b4p+0
+0x1.58ab96p-2
+0x1.b05058p+0
+0x1.b96b4ep+1
+0x1.989734p+1
+0x1.e3e296p+1
+0x1.1198dp+1
+0x1.1e80acp+0
+0x1.4d14eap+0
+0x1.2c71b4p+1
+0x1.76094cp+1
+0x1.2798dep+0
+0x1.54283ep+1
+0x1.eded84p-1
+0x1.478342p-8
+0x1.b05644p+0
+0x1.0c7892p+0
+0x1.14a794p+0
+0x1.6c3302p+0
+0x1.b09d68p+1
+0x1.a7f6f2p+1
+0x1.2bd8fap-3
+0x1.af5d4ap+1
+0x1.dd6366p+1
+0x1.bb35d2p+1
+0x1.9c0084p+1
+0x1.fecaccp-1
+0x1.fa8a3cp-1
+0x1.3fc164p+1
+0x1.6d2c9ep+1
+0x1.88348ap+0
+0x1.571fa4p-7
+0x1.c5e7eep+1
+0x1.3fd334p-1
+0x1.7fa944p+1
+0x1.7b77e8p+1
+0x1.1d562p+0
+0x1.8f723ep+1
+0x1.2da99cp+1
+0x1.1ba908p+1
+0x1.b67844p+0
+0x1.13d734p-9
+0x1.8f35bep-4
+0x1.e10636p+1
+0x1.5e90f2p+1
+0x1.eae2b4p+1
+0x1.4565d2p-2
+0x1.695658p+1
+0x1.a5acecp+1
+0x1.594ac6p+0
+0x1.19697p-1
+0x1.b58114p-4
+0x1.9e658ap-3
+0x1.680022p+1
+0x1.bc4e46p-3
+0x1.5a63e6p+0
+0x1.0ce218p+1
+0x1.6b57c4p+0
+0x1.02ef42p+1
+0x1.beb706p-3
+0x1.872452p+0
+0x1.7e11c6p-1
+0x1.abfbfcp-2
+0x1.539022p+0
+0x1.5533ep-1
+0x1.9a3f96p+1
+0x1.f91f8ep+0
+0x1.1055e6p+1
+0x1.a5b114p-4
+0x1.f227fep+0
+0x1.a29084p+1
+0x1.d6d17ap-2
+0x1.69ca2cp+1
+0x1.f50064p+1
+0x1.f34d2ep+1
+0x1.3ce0bap-3
+0x1.04e4ep+1
+0x1.6074dcp+1
+0x1.34a3ccp+0
+0x1.4554e4p-1
+0x1.bcc5dcp+1
+0x1.5bf646p-1
+0x1.b1d1dep+0
+0x1.accaeep-2
+0x1.6b27a4p+1
+0x1.70484ep+1
+0x1.0679e6p+1
+0x1.6355a6p+1
+0x1.6f5c52p+1
+0x1.40c4d2p+1
+0x1.553edp+1
+0x1.607faap+1
+0x1.6a49c2p+1
+0x1.5d70bcp+1
+0x1.043702p+0
+0x1.e8b732p+1
+0x1.7e7108p+0
+0x1.c08a82p+0
+0x1.63aa1p+1
+0x1.871e4ep+1
+0x1.29bb98p+1
+0x1.c6b566p+1
+0x1.838e08p-3
+0x1.013a24p+1
+0x1.aa4d8p+1
+0x1.72ddacp+0
+0x1.0e228ap+1
+0x1.2b9ad4p+0
+0x1.97967ep+1
+0x1.70b072p+0
+0x1.3193b2p-2
+0x1.65fafep+1
+0x1.79b50ap+0
+0x1.18ee5p-1
+0x1.f515bep+1
+0x1.8c32cep+1
+0x1.8c9946p+1
+0x1.92ef08p-1
+0x1.af71dep+1
+0x1.4363fp+1
+0x1.ffee74p+0
+0x1.281784p+1
+0x1.d2b744p+1
+0x1.48d82ap+0
+0x1.35cfd8p+1
+0x1.291464p+1
+0x1.89b068p-4
+0x1.66a79ap-1
+0x1.f1691ep+1
+0x1.5a43bap+1
+0x1.afcd4ap+1
+0x1.311728p+1
+0x1.9ab1e4p+0
+0x1.6eb968p+1
+0x1.401d62p+0
+0x1.812e92p+0
+0x1.61454ap+0
+0x1.8d76a6p+1
+0x1.57feeep-1
+0x1.aae1b8p-1
+0x1.bb8362p+0
+0x1.e7093ep+0
+0x1.178258p+1
+0x1.6bd848p+0
+0x1.d0245cp+1
+0x1.7e10ecp-2
+0x1.3cfbdap-3
+0x1.743466p+1
+0x1.d2c008p+1
+0x1.dbae7cp+0
+0x1.612f8ep+0
+0x1.73c834p+0
+0x1.bc1deap+1
+0x1.85e39p-1
+0x1.2d362ap+1
+0x1.c9d2f4p+0
+0x1.aa4136p-1
+0x1.7e7f0ap-1
+0x1.5612bp+1
+0x1.b03fbep+0
+0x1.8dfa12p+1
+0x1.7447c6p+0
+0x1.d33da4p-1
+0x1.dff4ap+0
+0x1.db7ee6p+1
+0x1.de0caep+0
+0x1.2898acp-4
+0x1.07e456p+1
+0x1.19621p-1
+0x1.8a3146p+1
+0x1.25537ep+1
+0x1.0fe8a6p+0
+0x1.b18676p+1
+0x1.5a0bc6p+0
+0x1.81e70cp+1
+0x1.a92e9cp+1
+0x1.9d7552p+1
+0x1.63f83p-3
+0x1.787b68p+0
+0x1.35ad04p+1
+0x1.101692p-3
+0x1.700adcp+1
+0x1.e3bcfcp+0
+0x1.398884p+0
+0x1.0c4372p-1
+0x1.c36118p+1
+0x1.fc1c62p+0
+0x1.27fd2ep+1
+0x1.e5920ap+0
+0x1.44e2a8p-6
+0x1.2050dep-3
+0x1.65dbe6p+1
+0x1.34b6dp+0
+0x1.97961ep+0
+0x1.4adfa2p+1
+0x1.b521bp-1
+0x1.24ecd6p+0
+0x1.cc8218p+1
+0x1.612bf2p+0
+0x1.0de564p-1
+0x1.1ffc94p+1
+0x1.7f71e2p+0
+0x1.fd4a06p-1
+0x1.4cee9ep+1
+0x1.7207fep-1
+0x1.16de3ep+0
+0x1.bca0f4p+0
+0x1.58fcdcp-1
+0x1.054ecep+1
+0x1.1b61cep+1
+0x1.d0228ep-2
+0x1.6f7f4ep+1
+0x1.b64b04p-1
+0x1.4294b6p-4
+0x1.6eaf3ep+1
+0x1.f05fb6p+1
+0x1.df333ep+1
+0x1.2623fcp+1
+0x1.16ea64p+1
+0x1.de1d66p+0
+0x1.c31e48p-2
+0x1.ba373p-1
+0x1.b6848ap+1
+0x1.30fe1p+1
+0x1.f6f3ap-2
+0x1.243ebap+0
+0x1.079442p+1
+0x1.4b7264p+1
+0x1.a9c97ep+0
+0x1.1272e8p+1
+0x1.9ee754p+1
+0x1.d54e68p+0
+0x1.172b06p+1
+0x1.d4935cp+1
+0x1.3e050ep+1
+0x1.220bdap+1
+0x1.849544p+0
+0x1.478ea8p+0
+0x1.c3ac82p-3
+0x1.840b62p+1
+0x1.3143cp+1
+0x1.ed69dep-1
+0x1.5c42f4p+1
+0x1.805356p+1
+0x1.a2b3bcp-5
+0x1.6fb19cp-1
+0x1.5f4f98p+1
+0x1.d2235ap+1
+0x1.e67092p+1
+0x1.0b3f3ap-1
+0x1.8351ap+0
+0x1.2aed02p-1
+0x1.68ca1ap+1
+0x1.e88534p+0
+0x1.a4e0e4p+0
+0x1.42332p+0
+0x1.36a7fep+0
+0x1.d739e6p+1
+0x1.b468dep+0
+0x1.ec4636p+0
+0x1.306664p+0
+0x1.15466ap-1
+0x1.7ba956p+0
+0x1.b7d10ep+1
+0x1.f36572p-2
+0x1.932fd8p+0
+0x1.e22a8ep+1
+0x1.e11602p+1
+0x1.808bbcp+1
+0x1.8aff22p+0
+0x1.7eab7cp+1
+0x1.10cbf8p+1
+0x1.df09c6p+0
+0x1.2307eap+1
+0x1.7821f6p+0
+0x1.7f6ccap+1
+0x1.a61192p+1
+0x1.0290cp+1
+0x1.590158p+1
+0x1.50313ap+1
+0x1.9cc2ecp+0
+0x1.5d787p+0
+0x1.0c14e2p-1
+0x1.79aecp+0
+0x1.6d57ecp+1
+0x1.d8bffp-3
+0x1.c5fe96p+1
+0x1.f3643ap-2
+0x1.7f3df2p+0
+0x1.acffe2p+1
+0x1.69eed2p+1
+0x1.8eed02p+1
+0x1.4ae8dcp-1
+0x1.303e76p+1
+0x1.950e96p-3
+0x1.43374ep-1
+0x1.4fa4b2p-1
+0x1.ff8ee8p-1
+0x1.4fa0e8p+1
+0x1.06bfdcp+1
+0x1.b1272cp+1
+0x1.b6bc16p+1
+0x1.b84282p+1
+0x1.e810fcp+1
+0x1.3b7b94p+1
+0x1.231086p+1
+0x1.f6578p+0
+0x1.dc115ep+1
+0x1.43549ap+1
+0x1.f7f6c8p+0
+0x1.f0b0fp-2
+0x1.261606p-2
+0x1.289c68p+1
+0x1.437272p+0
+0x1.9a239ep-1
+0x1.a6e29ap-1
+0x1.e5a916p+1
+0x1.a7138ap-4
+0x1.daa6b8p+1
+0x1.71b6e2p-1
+0x1.39334p+1
+0x1.b6243ep-2
+0x1.b756fap+1
+0x1.2a003ep-1
+0x1.e7ea84p+1
+0x1.2a7954p+1
+0x1.723274p+1
+0x1.4f6fd6p+1
+0x1.97163cp-2
+0x1.9cd784p+1
+0x1.88de72p+0
+0x1.e4693p-2
+0x1.43a1p+1
+0x1.f74888p+0
+0x1.69be38p+1
+0x1.b498fcp+0
+0x1.409746p+1
+0x1.68e758p+1
+0x1.3b0c9ep+0
+0x1.09976ap+1
+0x1.3e39a8p-2
+0x1.5686fcp+1
+0x1.46ade2p+1
+0x1.5d2cb2p+1
+0x1.6432acp+0
+0x1.9fc728p+1
+0x1.7d399ep+1
+0x1.175a2ap-1
+0x1.8558dcp+1
+0x1.f53ebp-1
+0x1.20053cp+0
+0x1.7c2396p+1
+0x1.793deep+1
+0x1.5a8a6ep+1
+0x1.c81fbep-2
+0x1.70591ap-1
+0x1.6a0bdap-1
+0x1.8fc3d4p+0
+0x1.40a06ep+1
+0x1.cc8688p+1
+0x1.d35e88p+1
+0x1.b4dacp-1
+0x1.e7224p+1
+0x1.842e6p+0
+0x1.29d694p+1
+0x1.b75514p+0
+0x1.c34e7ap+0
+0x1.1cb6fcp-3
+0x1.5ae01ep-1
+0x1.4cf9f8p+0
+0x1.a302fep+1
+0x1.8ff134p-2
+0x1.c4891cp+1
+0x1.ef35f8p-1
+0x1.76fd22p+1
+0x1.9c63f8p-1
+0x1.100294p-2
+0x1.196498p-1
+0x1.b3ba34p+1
+0x1.ed86c2p-2
+0x1.9b3752p+1
+0x1.cf7f42p+1
+0x1.eb2154p+0
+0x1.15e3f4p-1
+0x1.0b283ap+1
+0x1.0be5ap+1
+0x1.421758p+0
+0x1.ed0372p+0
+0x1.58073ep+1
+0x1.d7685ep+1
+0x1.02e13ep+1
+0x1.ba7496p-1
+0x1.bb081p+1
+0x1.a16588p+1
+0x1.f031cap+1
+0x1.da56fp+1
+0x1.75544ep+1
+0x1.31019cp+1
+0x1.279198p+1
+0x1.95c92cp+0
+0x1.f2e7f2p+0
+0x1.8caecp+0
+0x1.72be8cp-6
+0x1.39d196p-3
+0x1.cb355ap-2
+0x1.93f8a4p-2
+0x1.84de94p+1
+0x1.f03fp-1
+0x1.a3f4b8p+0
+0x1.b300e8p+1
+0x1.b5a536p+1
+0x1.7e2818p+0
+0x1.5213dep+1
+0x1.2017eep+1
+0x1.e245b2p+1
+0x1.ff615ap+0
+0x1.659b7cp+0
+0x1.b823fep+0
+0x1.f0456cp+1
+0x1.026b12p+1
+0x1.7bba46p+1
+0x1.e6822ap+1
+0x1.b48a4p+0
+0x1.5291c8p+1
+0x1.aa99c2p-3
+0x1.10d8e8p+0
+0x1.2581f4p+1
+0x1.616a76p+0
+0x1.c311eep-1
+0x1.26f70ap-3
+0x1.3f1c3ap+1
+0x1.c7e808p-2
+0x1.111654p+0
+0x1.2f8042p+1
+0x1.3e6674p-1
+0x1.a1039ap+1
+0x1.5b9178p-1
+0x1.0db16p-1
+0x1.b58512p+1
+0x1.5eb1d6p-1
+0x1.418044p+0
+0x1.2ffe0ep+1
+0x1.378208p+1
+0x1.9ea87ap+0
+0x1.e54596p-2
+0x1.f6d968p-1
+0x1.6b7056p+1
+0x1.f11f32p-1
+0x1.7a3096p+1
+0x1.c1c826p+0
+0x1.efe552p+0
+0x1.e61396p+1
+0x1.e37e06p+1
+0x1.82b3ap+0
+0x1.966dccp+1
+0x1.0e466p+1
+0x1.efed28p+1
+0x1.e36132p+1
+0x1.333756p+1
+0x1.3a365p+1
+0x1.ad9976p-5
+0x1.bd627ep+1
+0x1.51c5dp+1
+0x1.687f2ap+0
+0x1.a58778p+1
+0x1.bca172p+0
+0x1.99d50ep-1
+0x1.414508p+1
+0x1.ccca06p+0
+0x1.ba7c34p+1
+0x1.091ed8p+1
+0x1.2de682p+0
+0x1.0c339cp+0
+0x1.7ef23ep+1
+0x1.937f26p+1
+0x1.2f33a6p+0
+0x1.0a89dep-2
+0x1.c5e012p-1
+0x1.0b1b7p+1
+0x1.afc0b8p+1
+0x1.e354ecp+1
+0x1.905558p-6
+0x1.892ff8p+1
+0x1.c913d8p+1
+0x1.9fe02cp+0
+0x1.035d54p+1
+0x1.cdd148p+0
+0x1.b51494p-2
+0x1.b112bap+0
+0x1.2cab5cp+1
+0x1.23cf7ap+0
+0x1.ec743ap-1
+0x1.49a22p+1
+0x1.4dc4fcp+1
+0x1.e0a0bp-1
+0x1.2ea1c6p+1
+0x1.4a8fa8p-3
+0x1.591904p-1
+0x1.bb6668p+0
+0x1.27b8cp+1
+0x1.08df38p+1
+0x1.e848c6p+1
+0x1.d2ec06p+1
+0x1.d169f4p-1
+0x1.626128p-1
+0x1.708f46p-1
+0x1.ddf4dcp+1
+0x1.cd6c44p+1
+0x1.f4a4aep+1
+0x1.f1c93ep+1
+0x1.0e0e86p+0
+0x1.a4fe6cp+1
+0x1.fc563ep+0
+0x1.78772ep+0
+0x1.55b78ep+0
+0x1.fa51f6p-1
+0x1.8f7536p+1
+0x1.f05a68p+1
+0x1.062674p+0
--
2.43.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 03/11] benchtests: Add erfcf benchmark
2024-11-11 13:45 [PATCH 00/11] Add more CORE-math implementations to libm Adhemerval Zanella
2024-11-11 13:45 ` [PATCH 01/11] benchtests: Add cbrtf benchmark Adhemerval Zanella
2024-11-11 13:45 ` [PATCH 02/11] benchtests: Add erff benchmark Adhemerval Zanella
@ 2024-11-11 13:45 ` Adhemerval Zanella
2024-11-20 21:41 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 04/11] benchtests: Add lgammaf benchmark Adhemerval Zanella
` (7 subsequent siblings)
10 siblings, 1 reply; 34+ messages in thread
From: Adhemerval Zanella @ 2024-11-11 13:45 UTC (permalink / raw)
To: libc-alpha
It is based on binary64 erfc-inputs, with random inputs in
[0,b=0x1.41bbf6p+3] where b in the smallest number such that
erfcf(b) rounds to 0 (to nearest).
---
benchtests/Makefile | 1 +
benchtests/erfcf-inputs | 795 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 796 insertions(+)
create mode 100644 benchtests/erfcf-inputs
diff --git a/benchtests/Makefile b/benchtests/Makefile
index 36b8296958..7eaea139a9 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -40,6 +40,7 @@ bench-math := \
cosh \
erf \
erfc \
+ erfcf \
erff \
exp \
exp10 \
diff --git a/benchtests/erfcf-inputs b/benchtests/erfcf-inputs
new file mode 100644
index 0000000000..2c46593140
--- /dev/null
+++ b/benchtests/erfcf-inputs
@@ -0,0 +1,795 @@
+## args: float
+## ret: float
+## includes: math.h
+# Random inputs in [0,b=0x1.41bbf6p+3]
+# where b in the smallest number such that erfcf(b) rounds to 0 (to nearest)
+## name: workload-random
+0x1.599288p+1
+0x1.6309e8p-1
+0x1.c02778p+0
+0x1.e654dp+1
+0x1.b2547ep+1
+0x1.1715dap+1
+0x1.eec122p+2
+0x1.b6d106p+2
+0x1.8d823ap+2
+0x1.b7517p+2
+0x1.ce66e2p+2
+0x1.a4513p+2
+0x1.115cfcp+2
+0x1.971ecp-1
+0x1.15e002p+1
+0x1.35b134p+3
+0x1.2e5176p+3
+0x1.d5d11ep+2
+0x1.a546fep+1
+0x1.e4124p+2
+0x1.9eac9ap+2
+0x1.718dep-2
+0x1.6c37b8p+1
+0x1.6f5702p+2
+0x1.bd468ap+2
+0x1.a033ep+1
+0x1.33eabep+2
+0x1.8374d8p+2
+0x1.3bd382p+0
+0x1.7dcfc6p+1
+0x1.b88ed2p+1
+0x1.623994p+2
+0x1.607a4cp+0
+0x1.9246acp+2
+0x1.056e38p+1
+0x1.04644cp+1
+0x1.998e4ep+2
+0x1.c046c4p+1
+0x1.c4dc78p+1
+0x1.25f6a2p+1
+0x1.72376cp-1
+0x1.d4b032p+2
+0x1.111456p+3
+0x1.adea1ap+1
+0x1.622bfap+2
+0x1.e28086p+2
+0x1.a6a556p+2
+0x1.410c9ep+1
+0x1.02f2e6p+3
+0x1.b0388cp+0
+0x1.b047bap+1
+0x1.1f3b5ap+2
+0x1.9ac788p+1
+0x1.a40238p+2
+0x1.d92756p+1
+0x1.36e328p+1
+0x1.dd92ap-1
+0x1.329f6p+1
+0x1.fe2718p+1
+0x1.1973d6p+2
+0x1.d63fe6p+1
+0x1.9546cep+1
+0x1.faca46p+2
+0x1.de40b4p-2
+0x1.d540dep+2
+0x1.888322p+2
+0x1.c9b20cp+0
+0x1.b66b84p+2
+0x1.4e6e08p+1
+0x1.61f8f4p+2
+0x1.5d9732p+2
+0x1.d43d28p-1
+0x1.eba1e2p+2
+0x1.5c7a1cp+0
+0x1.427124p+2
+0x1.3d135ap+3
+0x1.9b3b7ap+2
+0x1.5c719cp+0
+0x1.6df80ap+1
+0x1.1bd402p+2
+0x1.0c01f8p+2
+0x1.f84896p+0
+0x1.1fa426p+3
+0x1.dfd60cp-3
+0x1.a6c104p+2
+0x1.7de2p-1
+0x1.072abp+3
+0x1.46a4a4p+2
+0x1.cdaa24p+2
+0x1.fda388p+1
+0x1.d2e65ep+2
+0x1.5ff646p+0
+0x1.4bdb28p+1
+0x1.2dde6cp+3
+0x1.4a8e5p+1
+0x1.3467cp+3
+0x1.c9eefep+2
+0x1.2f665ep+3
+0x1.2ec086p+1
+0x1.1107c6p+3
+0x1.efc5fcp+2
+0x1.7c6bc8p+1
+0x1.d3b834p+0
+0x1.6064dep+0
+0x1.953526p-1
+0x1.38a0e4p+3
+0x1.a58218p+1
+0x1.ed8578p+2
+0x1.312ec2p+2
+0x1.d884fap+0
+0x1.345e2ep+2
+0x1.e89836p+1
+0x1.1fdd7ap+3
+0x1.d03192p+2
+0x1.22d9f8p+2
+0x1.14d88ap+3
+0x1.c22afp-1
+0x1.eaeac2p+2
+0x1.2252e2p+2
+0x1.9149d2p-1
+0x1.c40d7p+0
+0x1.0c0ccap+3
+0x1.815152p+2
+0x1.4f39d4p+1
+0x1.30b01cp+3
+0x1.50c01cp+2
+0x1.cbb3fp+2
+0x1.911ba8p+0
+0x1.bee5e4p+0
+0x1.c33322p+0
+0x1.54c6c6p+1
+0x1.184e36p+2
+0x1.066b9cp+2
+0x1.4be8ap+1
+0x1.927128p+2
+0x1.5a0308p+2
+0x1.8d10dp+2
+0x1.1c890cp+0
+0x1.38b936p+3
+0x1.74dc9cp+1
+0x1.28011ap+2
+0x1.21c7b6p+2
+0x1.1aaf36p+3
+0x1.c1befep-1
+0x1.f12b48p+1
+0x1.1985c6p+3
+0x1.f736fp+1
+0x1.0a6372p+3
+0x1.03241cp+3
+0x1.0f18ccp+1
+0x1.1c4968p+2
+0x1.fcd214p+1
+0x1.a23ff8p-2
+0x1.f3e3e6p+2
+0x1.0967dep+3
+0x1.2e3c1cp+2
+0x1.e30dfcp+0
+0x1.5ec456p+1
+0x1.24368cp+3
+0x1.1206a6p+3
+0x1.f5733ap+2
+0x1.6db898p+2
+0x1.06f78ap+2
+0x1.588132p+2
+0x1.41c9dep+1
+0x1.278b34p+2
+0x1.0ef4a2p+2
+0x1.f26bfap+0
+0x1.8d5252p+2
+0x1.ffa79cp+2
+0x1.12fc7ep+0
+0x1.8dd8a6p+2
+0x1.41d33cp+2
+0x1.1920b2p+3
+0x1.ecfc9p+2
+0x1.455fb8p+2
+0x1.6c5b3ep+2
+0x1.ecf518p+2
+0x1.df076p+2
+0x1.2dc028p+3
+0x1.a23cf6p-1
+0x1.4b9716p+2
+0x1.2b7be4p+3
+0x1.b0f7d8p+2
+0x1.1549c2p+3
+0x1.eaf7d2p+0
+0x1.304f44p+3
+0x1.e9f16ep+2
+0x1.e168dap-4
+0x1.2edb1cp+2
+0x1.07c49ep+2
+0x1.276696p+2
+0x1.b8d964p+2
+0x1.c8ad5ep+2
+0x1.48a2ep+0
+0x1.2fc204p+3
+0x1.2d5d5ap+3
+0x1.275824p+3
+0x1.105ddcp+2
+0x1.f9e7ep-2
+0x1.1877d6p+3
+0x1.8d926p+1
+0x1.a8c6c6p+0
+0x1.d27f48p+2
+0x1.8ec5d2p+2
+0x1.c1bc1ap+2
+0x1.ffe57cp+2
+0x1.0e56a4p+2
+0x1.7e8472p-1
+0x1.1e46b6p+3
+0x1.cd6758p+2
+0x1.75b5fp+2
+0x1.e17b3ep-1
+0x1.41a7dp+3
+0x1.1dd2f4p+3
+0x1.f28c56p-1
+0x1.d04dacp+2
+0x1.9a027ep+1
+0x1.829162p+2
+0x1.269692p+3
+0x1.28dcacp+3
+0x1.c5fd34p+2
+0x1.26b60ep+3
+0x1.c04c98p+1
+0x1.a1fc5cp+2
+0x1.55dac6p+2
+0x1.44e904p-2
+0x1.039adp+2
+0x1.ccd75p+2
+0x1.1c9daep+3
+0x1.3d6232p+3
+0x1.d3da94p+2
+0x1.171392p-1
+0x1.a3ede2p+0
+0x1.79b6e4p-1
+0x1.0c49d8p+1
+0x1.ec1abep+2
+0x1.2bb1d4p+2
+0x1.0e109ep+3
+0x1.145cfep+3
+0x1.1a1726p+3
+0x1.27e514p-1
+0x1.7c51fep-1
+0x1.cd02bp+2
+0x1.8f7d54p+1
+0x1.0f9ea6p+1
+0x1.5b6e0ep+1
+0x1.a5f14p+1
+0x1.1995dap+2
+0x1.0d1664p+3
+0x1.00ae76p+3
+0x1.d2e09p+2
+0x1.5eec0cp+2
+0x1.17423cp+3
+0x1.57152ap+0
+0x1.646646p+1
+0x1.2d0586p+2
+0x1.40e086p+2
+0x1.1cdfa2p+0
+0x1.d0f7fep+0
+0x1.c0a4a8p+0
+0x1.6f885ep+2
+0x1.d485cap+2
+0x1.502522p+2
+0x1.225a7ap+3
+0x1.c67fe6p+2
+0x1.41f3acp+1
+0x1.7cd126p+2
+0x1.c6540cp+2
+0x1.f37b3cp+2
+0x1.79c12cp+0
+0x1.b510d2p+2
+0x1.1d5e48p+3
+0x1.72fac6p+1
+0x1.1ae9p+3
+0x1.1adaa8p+3
+0x1.323476p+3
+0x1.ee54b8p+2
+0x1.8ee008p+2
+0x1.df8f9ap+1
+0x1.27879ep+3
+0x1.1d09f6p+0
+0x1.4ee52ap+1
+0x1.945148p+2
+0x1.51c588p+2
+0x1.f0b77cp+1
+0x1.37676p+3
+0x1.c477b4p+1
+0x1.c3a09p-1
+0x1.53cd4ap+2
+0x1.0c8b04p+2
+0x1.cc42ecp+0
+0x1.18bf72p+2
+0x1.350a3ep+3
+0x1.17ec1ep+3
+0x1.00e4eep+3
+0x1.0e2628p+3
+0x1.467e2cp+1
+0x1.20626ap+3
+0x1.1095c4p+3
+0x1.45ec42p+2
+0x1.2328cap+3
+0x1.03233ep+3
+0x1.56831ap-2
+0x1.62c568p+0
+0x1.828f9ep+2
+0x1.d9325ep+2
+0x1.86dd1p+2
+0x1.27e742p+0
+0x1.05da5ap+1
+0x1.ce91bp+2
+0x1.91f644p-3
+0x1.e2a36ap-1
+0x1.f40ed8p+2
+0x1.0aadbp+1
+0x1.db633ap+2
+0x1.0b9d32p+3
+0x1.0a365p+3
+0x1.7ef782p+2
+0x1.14361cp+3
+0x1.2ef9c6p+3
+0x1.911facp-1
+0x1.9aa1fep+2
+0x1.31febep+2
+0x1.0384bap+2
+0x1.29b746p+2
+0x1.941162p+0
+0x1.428426p+2
+0x1.29bb3cp+3
+0x1.387cb6p+0
+0x1.3d33e8p+2
+0x1.6a11d8p+0
+0x1.4e1ef4p+1
+0x1.4c333ap+2
+0x1.158d86p+3
+0x1.771328p-3
+0x1.7c0164p+0
+0x1.e51d0ep+1
+0x1.16b2dcp+2
+0x1.19968p+2
+0x1.2242ecp+3
+0x1.2142aep+3
+0x1.88fa48p+2
+0x1.ae3f84p+1
+0x1.24080ap+3
+0x1.d0b3e8p+1
+0x1.198ddcp+3
+0x1.a8546ep-2
+0x1.c3cedp+2
+0x1.2f790ep+3
+0x1.feda2ap-2
+0x1.308c06p+3
+0x1.98a752p+0
+0x1.1e5798p+2
+0x1.a26ed4p-1
+0x1.85a83ep+0
+0x1.025ap+2
+0x1.3ca802p+3
+0x1.d852a6p+2
+0x1.f77932p+2
+0x1.0b8c94p+2
+0x1.19332cp+1
+0x1.edf502p+1
+0x1.2a64b8p+3
+0x1.c60fe6p+2
+0x1.08ec18p+3
+0x1.10ba9ep+1
+0x1.e6a58p+2
+0x1.23c154p+3
+0x1.2bb994p+3
+0x1.4f3f9ap+1
+0x1.3744ep+1
+0x1.915a92p-1
+0x1.f50888p+1
+0x1.b6ba4p+1
+0x1.a005aep+2
+0x1.399ba4p+1
+0x1.914f82p+2
+0x1.3ce532p+3
+0x1.1beafp+1
+0x1.1a812p+3
+0x1.b74abp+2
+0x1.3635b2p-2
+0x1.04f086p+2
+0x1.755da8p+2
+0x1.b8cfaep-1
+0x1.1473p+1
+0x1.b8041p+1
+0x1.2f97fap+2
+0x1.b576e4p+2
+0x1.846dap+1
+0x1.e47b2ep+2
+0x1.c2a946p+1
+0x1.3fd7b6p+2
+0x1.dc0f2cp-1
+0x1.7e1218p+1
+0x1.d2c8dcp+2
+0x1.472272p+0
+0x1.641e64p+0
+0x1.01a42ap+2
+0x1.158b02p+2
+0x1.442ab4p+1
+0x1.4dbb1p+2
+0x1.0ed2a4p+3
+0x1.21fa78p+2
+0x1.26437ap-1
+0x1.e14858p+2
+0x1.02e634p+3
+0x1.73491ep+2
+0x1.e354b4p+2
+0x1.87d4bep+1
+0x1.f0ce06p+0
+0x1.2e96bap-1
+0x1.2ae62cp+3
+0x1.386692p+0
+0x1.2aa6aap+3
+0x1.a3d016p+0
+0x1.9313f8p+1
+0x1.80424p-1
+0x1.72453cp+2
+0x1.311d18p+1
+0x1.bc4058p+2
+0x1.702c9p+2
+0x1.350706p+2
+0x1.86324ep+2
+0x1.be1a5p+2
+0x1.2b435cp+3
+0x1.60f778p+0
+0x1.0742d8p+3
+0x1.191bb4p+2
+0x1.e077c6p+1
+0x1.ea9dacp+2
+0x1.7941ep+2
+0x1.d544c8p+2
+0x1.5b5e72p-4
+0x1.ed4b62p+2
+0x1.60cef4p+2
+0x1.63674ap+0
+0x1.d5d54ep+2
+0x1.e61e8p+2
+0x1.54b516p+0
+0x1.ed648cp+2
+0x1.290dcep+0
+0x1.cd0064p+2
+0x1.88b284p-1
+0x1.45d2f6p+0
+0x1.75f344p+2
+0x1.c31888p+1
+0x1.bd1a56p+0
+0x1.23b6fcp+2
+0x1.088244p+2
+0x1.042f36p+3
+0x1.cb7d6ep+2
+0x1.7f0f4ep+2
+0x1.6ef664p+1
+0x1.0c2a46p+2
+0x1.8d0a9ep+1
+0x1.341accp+1
+0x1.e4261ap+2
+0x1.aee89ep+2
+0x1.64e81p-1
+0x1.5e59a4p+1
+0x1.2b8aecp+2
+0x1.17ea2p+3
+0x1.f88bbep+1
+0x1.133afep+1
+0x1.116c6cp+2
+0x1.a4993ep+2
+0x1.f435bcp+2
+0x1.c23a96p+0
+0x1.29a256p+3
+0x1.9744bep-2
+0x1.118a9ep+3
+0x1.2eb6f6p+2
+0x1.d02cc4p+2
+0x1.35b38p+3
+0x1.0684b8p+2
+0x1.07c4fep+3
+0x1.3fe034p+3
+0x1.27334ap+3
+0x1.229376p+3
+0x1.aeaae4p+1
+0x1.f08062p+1
+0x1.933e02p+0
+0x1.1a2702p+0
+0x1.08dafap+2
+0x1.147accp+3
+0x1.345bb8p+3
+0x1.4c184cp+1
+0x1.267932p-1
+0x1.16b15p+2
+0x1.68ceeap+1
+0x1.cea952p-2
+0x1.64652ep+1
+0x1.0947ecp+2
+0x1.39afaap+3
+0x1.7505fcp+2
+0x1.6a0c94p+0
+0x1.424eb2p+0
+0x1.8d8dbp+2
+0x1.124592p+3
+0x1.8ea0f2p+2
+0x1.2d1a14p+3
+0x1.eb3628p+0
+0x1.58d9d6p+2
+0x1.7a22eap+1
+0x1.bbfe54p+1
+0x1.0cf26ep+2
+0x1.d56fc8p+2
+0x1.fedd7p+1
+0x1.dc081ap+2
+0x1.a4fb46p+2
+0x1.f4e956p+2
+0x1.419a3p+2
+0x1.14cdb6p-1
+0x1.dda3bcp+2
+0x1.a3f572p+2
+0x1.4dc052p-1
+0x1.b07ea8p+2
+0x1.3ff024p+2
+0x1.78af36p+2
+0x1.ec8d88p+2
+0x1.c8d4bep+0
+0x1.75ed3ap-2
+0x1.0edf74p+2
+0x1.4a7512p-2
+0x1.273f42p+2
+0x1.b0af26p+2
+0x1.1dd472p+2
+0x1.c2c2d2p+2
+0x1.82549cp+2
+0x1.cc4a1ap+2
+0x1.336554p+2
+0x1.3e7dd4p+3
+0x1.851a02p+2
+0x1.e58456p-1
+0x1.c3a96p+0
+0x1.69782ap+1
+0x1.b508a4p+2
+0x1.122796p-1
+0x1.e31838p-1
+0x1.57532p+1
+0x1.cc35ap+2
+0x1.f49e4ep+1
+0x1.289f1ep+3
+0x1.75758p+0
+0x1.954306p+2
+0x1.e811a8p+0
+0x1.3b405cp-3
+0x1.992492p+1
+0x1.68336p+1
+0x1.1c5196p+0
+0x1.669e84p+2
+0x1.25fc9ep+3
+0x1.4763ep+2
+0x1.25fe76p+1
+0x1.2f2262p+2
+0x1.b6ab0cp+2
+0x1.dddb56p+2
+0x1.a2c142p+1
+0x1.04cb34p+3
+0x1.5e2a7ep+2
+0x1.35f8acp+0
+0x1.511c32p-1
+0x1.9b01bcp+2
+0x1.3a83f8p+1
+0x1.32333cp+2
+0x1.e8680cp+2
+0x1.19be82p+3
+0x1.37a5f8p+3
+0x1.417534p+0
+0x1.6989e6p-1
+0x1.fd92e2p+1
+0x1.1a03e6p+3
+0x1.4a1fbep+0
+0x1.a7f82cp+2
+0x1.07d606p+3
+0x1.2ea5ap+2
+0x1.3261d8p+3
+0x1.2efe5ap-2
+0x1.9262eap+2
+0x1.b771fep-1
+0x1.e5e4p+2
+0x1.a65a04p+0
+0x1.1eaf6p+3
+0x1.8301b2p-1
+0x1.5fee84p+2
+0x1.3493a2p+1
+0x1.26e088p+3
+0x1.3e12dep-3
+0x1.8ff134p+2
+0x1.39ffdep+1
+0x1.d9fb2cp+2
+0x1.ed2af8p-1
+0x1.8f6c72p+0
+0x1.c188b4p+0
+0x1.f31b86p+1
+0x1.eae4fap+0
+0x1.2b4966p+2
+0x1.da647cp+0
+0x1.c91b4ep+2
+0x1.bbf08cp+1
+0x1.cc291ap+2
+0x1.1b29f4p+0
+0x1.55f758p-3
+0x1.3d782p+0
+0x1.03f4a8p-2
+0x1.d9306ep+1
+0x1.c5b27p+2
+0x1.71038ep+1
+0x1.0b807ap+1
+0x1.3c78bcp+2
+0x1.c7c18cp-2
+0x1.5e51ap-5
+0x1.3840ecp+2
+0x1.186b0ap+3
+0x1.c05d14p+2
+0x1.3bb9dap+3
+0x1.60b3d8p+0
+0x1.def62ep-1
+0x1.f1662cp+2
+0x1.e81886p+2
+0x1.ea4e8p+2
+0x1.46962cp+2
+0x1.378b82p+1
+0x1.b6781ap+2
+0x1.5df9fp+2
+0x1.aaaedep+0
+0x1.c218e8p+0
+0x1.54ccfap-1
+0x1.bac0f6p+2
+0x1.24fe86p+2
+0x1.0ab8eap+3
+0x1.3d2354p+1
+0x1.d24432p+2
+0x1.7c11acp+2
+0x1.b388a8p+0
+0x1.37aebep+3
+0x1.266718p+3
+0x1.2dfffp+1
+0x1.e8888p-3
+0x1.e65914p+2
+0x1.19f262p+0
+0x1.654a26p-1
+0x1.50b842p+2
+0x1.2593e2p+3
+0x1.5f03dap+0
+0x1.7e6ce6p-1
+0x1.7b586ep+2
+0x1.5b3c2ap+1
+0x1.f79258p+2
+0x1.3bb144p+3
+0x1.ef130ap+1
+0x1.4e1716p+2
+0x1.282f32p+1
+0x1.8ad63cp-1
+0x1.203b48p+0
+0x1.15792ep+0
+0x1.142f1cp+3
+0x1.4a78c8p+2
+0x1.cf512cp+2
+0x1.66676ep+2
+0x1.78b578p+1
+0x1.c37fd6p+2
+0x1.1cc856p+3
+0x1.bc687p+2
+0x1.a9faacp+2
+0x1.93c39ep+1
+0x1.6a9cdep-2
+0x1.32166cp+3
+0x1.9aa5bep+2
+0x1.1413f2p+3
+0x1.3835bp+3
+0x1.221712p+2
+0x1.39d4d4p+3
+0x1.a58c9p+0
+0x1.a286dcp+2
+0x1.aa22b8p+2
+0x1.019798p+2
+0x1.7f7a38p+0
+0x1.f214bp-2
+0x1.f783ap-1
+0x1.2ccdb2p+3
+0x1.84de98p+2
+0x1.4d986ep-2
+0x1.7649cap+2
+0x1.cb9d9cp+0
+0x1.1a7c98p+1
+0x1.e7ccbp+0
+0x1.498d8ap+1
+0x1.147658p+3
+0x1.f5ea62p-2
+0x1.cc8acep+1
+0x1.5b156ap+2
+0x1.8924dap+2
+0x1.b4cd22p+2
+0x1.3b8dfep+3
+0x1.e1931cp+0
+0x1.878c5p+2
+0x1.402bdap+3
+0x1.c8e57ep+1
+0x1.2a4f3cp+3
+0x1.9db45ap+1
+0x1.12abbcp+3
+0x1.2c7428p+2
+0x1.ad05f2p+2
+0x1.08c982p+3
+0x1.9095d6p+0
+0x1.e9422p+2
+0x1.441258p+0
+0x1.63520cp+0
+0x1.e45aep+0
+0x1.eb6082p+2
+0x1.2a725ep+2
+0x1.3b792ap+1
+0x1.3ca84cp+3
+0x1.fe20d6p+2
+0x1.308158p+1
+0x1.df5964p+2
+0x1.889264p+1
+0x1.1718bp+3
+0x1.a4dec2p+2
+0x1.17c632p+3
+0x1.393c4ep-1
+0x1.bc04ccp+2
+0x1.3f1162p+2
+0x1.13b302p+3
+0x1.e9ccbep+0
+0x1.986a3ep+1
+0x1.f27f08p+2
+0x1.0ab154p+2
+0x1.110c2p+3
+0x1.a842d2p+2
+0x1.191394p+2
+0x1.5eacbcp+2
+0x1.06c1cep+2
+0x1.0c8f04p-1
+0x1.08e7cp+3
+0x1.a3303p+1
+0x1.2e1514p+2
+0x1.07cb18p+1
+0x1.341c92p-1
+0x1.3514f4p+3
+0x1.1c93b4p-1
+0x1.39f878p+0
+0x1.ce87b2p+0
+0x1.421914p+1
+0x1.421486p+2
+0x1.592fd6p+2
+0x1.6353d4p-1
+0x1.2cdb74p+0
+0x1.62ce4ap+2
+0x1.8f37ecp+1
+0x1.af61e6p+2
+0x1.1d1a76p+2
+0x1.d23142p+2
+0x1.a838b8p+2
+0x1.04db92p+2
+0x1.1d069p+2
+0x1.bea8cep+2
+0x1.2d84e8p+2
+0x1.3e500ep+2
+0x1.54fb22p+0
+0x1.6435b8p+2
+0x1.3bd65p+3
+0x1.3013eep+3
+0x1.a4617p+2
+0x1.adcdd6p-1
+0x1.64a9ecp+1
+0x1.27912cp+3
+0x1.39e97ap-1
+0x1.211a7ap+3
+0x1.0620e2p+2
+0x1.97f504p+2
+0x1.7a9178p+2
+0x1.37f544p+3
+0x1.890b2ap+1
+0x1.288282p-2
+0x1.a4a298p-2
+0x1.af9172p+2
+0x1.7b02bcp+1
+0x1.eb1cc4p+2
+0x1.63f96p+2
+0x1.09782cp+3
+0x1.003912p+3
+0x1.f0660cp+2
+0x1.931464p+2
+0x1.ee1acp+0
+0x1.1262c8p+2
--
2.43.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 04/11] benchtests: Add lgammaf benchmark
2024-11-11 13:45 [PATCH 00/11] Add more CORE-math implementations to libm Adhemerval Zanella
` (2 preceding siblings ...)
2024-11-11 13:45 ` [PATCH 03/11] benchtests: Add erfcf benchmark Adhemerval Zanella
@ 2024-11-11 13:45 ` Adhemerval Zanella
2024-11-20 21:45 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 05/11] benchtests: Add tanf benchmark Adhemerval Zanella
` (6 subsequent siblings)
10 siblings, 1 reply; 34+ messages in thread
From: Adhemerval Zanella @ 2024-11-11 13:45 UTC (permalink / raw)
To: libc-alpha
Random inputs in the range [-20.0,20.0].
---
benchtests/Makefile | 1 +
benchtests/lgammaf-inputs | 1005 +++++++++++++++++++++++++++++++++++++
2 files changed, 1006 insertions(+)
create mode 100644 benchtests/lgammaf-inputs
diff --git a/benchtests/Makefile b/benchtests/Makefile
index 7eaea139a9..0db303a84a 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -70,6 +70,7 @@ bench-math := \
j0 \
j1 \
lgamma \
+ lgammaf \
llrint \
llrintf \
log \
diff --git a/benchtests/lgammaf-inputs b/benchtests/lgammaf-inputs
new file mode 100644
index 0000000000..794246198e
--- /dev/null
+++ b/benchtests/lgammaf-inputs
@@ -0,0 +1,1005 @@
+## args: float
+## ret: float
+## includes: math.h
+# Random inputs in the range [-20.0,20.0]
+## name: workload-random-m20-p20
+-0x1.7eb52p+1
+-0x1.69a06p+3
+-0x1.a042ccp+3
+0x1.7e9dc8p+3
+-0x1.5d8cap+1
+-0x1.1755b4p+4
+0x1.041908p+4
+0x1.075de4p+4
+0x1.4ab608p+3
+0x1.f4b4a8p+3
+0x1.3ff54p+4
+0x1.fdc038p+3
+0x1.56e1p+3
+0x1.9b90e8p+2
+0x1.1b6d8p+0
+0x1.ebe99p+2
+-0x1.32d9f6p+4
+-0x1.077c24p+3
+0x1.98f028p+3
+-0x1.20faf2p+4
+0x1.1363a8p+2
+-0x1.9636p-3
+-0x1.b2ea6ap+3
+0x1.c45a7p+3
+-0x1.f1bd7cp+3
+0x1.18877p+4
+-0x1.c9e64p+0
+0x1.1d1798p+4
+-0x1.0f91dcp+3
+0x1.9e1e5p+2
+-0x1.147684p+3
+-0x1.c2d68p+1
+0x1.6da84p+1
+0x1.90c538p+3
+0x1.83246p+3
+0x1.c7aa6p+3
+0x1.036b18p+2
+0x1.6ccf3p+2
+0x1.2961cp+1
+0x1.e7c7d8p+2
+0x1.f867ep+3
+0x1.b3a65p+1
+0x1.6b55p+1
+-0x1.99d596p+3
+-0x1.95a76cp+3
+-0x1.11793ep+4
+0x1.a2534p+3
+-0x1.f1a64cp+2
+-0x1.dc91b4p+2
+0x1.0f6d04p+3
+-0x1.07058p+1
+-0x1.fedfc6p+3
+-0x1.52c68p-1
+-0x1.6efcp-1
+-0x1.ad3c2p+2
+-0x1.182d2p+0
+0x1.72c268p+2
+0x1.39c078p+2
+-0x1.75d314p+2
+-0x1.3a54c8p+3
+-0x1.9401dp+3
+0x1.f9f848p+2
+-0x1.e4664p+2
+-0x1.f581c4p+2
+0x1.3950e8p+4
+-0x1.19358p+0
+0x1.1f4578p+4
+0x1.3b86p-1
+-0x1.4658bp+1
+-0x1.5a405cp+3
+-0x1.1ba79cp+4
+-0x1.901d4p+0
+0x1.728cep+3
+0x1.3f3e6p+4
+-0x1.cfbbep+3
+-0x1.bb97p+0
+-0x1.5b482p+1
+0x1.1e8bp-2
+-0x1.0ee5aap+4
+-0x1.f752p-2
+0x1.2f51d4p+4
+0x1.259674p+4
+-0x1.1bdf68p+2
+0x1.8c3e18p+3
+-0x1.8102e4p+2
+0x1.8da2a8p+3
+0x1.63d22p+2
+0x1.e1476p+0
+-0x1.74c5ep+1
+0x1.a6118p+3
+-0x1.cd828p+0
+-0x1.337bd6p+4
+0x1.e47aep+2
+-0x1.60d3eep+3
+0x1.065e1cp+3
+0x1.9ab6p-2
+-0x1.2fc746p+4
+0x1.3c28a8p+4
+-0x1.ded2eep+3
+-0x1.d44338p+2
+-0x1.44529cp+3
+0x1.3a3b9p+4
+0x1.c4e34p+0
+0x1.a46d2p+3
+0x1.f90bbp+3
+0x1.36ab2p+4
+0x1.1d5c4p+4
+-0x1.b46ap+2
+-0x1.9a49dp+2
+0x1.ce1468p+3
+0x1.9d6e28p+3
+-0x1.2afb96p+4
+0x1.14c484p+4
+0x1.c8b62p+2
+0x1.0b2fc4p+4
+-0x1.130e1ep+4
+-0x1.07ac9cp+3
+-0x1.a98544p+2
+0x1.c9e418p+3
+0x1.9e3978p+3
+-0x1.8ce2ap+0
+-0x1.070784p+4
+-0x1.fd5a52p+3
+-0x1.a6442p+0
+-0x1.60f7dp+1
+0x1.b47e88p+3
+0x1.de245p+3
+0x1.229394p+3
+0x1.0384c8p+4
+0x1.057fbp+3
+-0x1.fd2bfcp+3
+0x1.ad41fp+3
+0x1.c47a08p+3
+0x1.27e794p+3
+0x1.d44cap+3
+-0x1.92fa8p-2
+-0x1.c413e4p+3
+0x1.3a858p-2
+0x1.210fcp+1
+-0x1.373444p+2
+-0x1.48565p+2
+0x1.f29b5p+3
+-0x1.3af7cp+1
+0x1.a3c87p+1
+-0x1.0f344p-1
+0x1.16744p+4
+0x1.2a06ccp+4
+0x1.23efe4p+4
+-0x1.257758p+4
+0x1.83ff5p+3
+-0x1.089d74p+4
+-0x1.9545ep+0
+-0x1.c682dcp+2
+0x1.17fp+0
+0x1.28db38p+4
+-0x1.600dc6p+3
+0x1.d7f13p+3
+-0x1.c88334p+2
+-0x1.1e2494p+2
+0x1.0346fcp+4
+-0x1.5b582cp+2
+-0x1.fd051p+3
+0x1.a86548p+3
+-0x1.37805ep+4
+-0x1.994474p+3
+0x1.4585ep+2
+0x1.58541p+2
+-0x1.02a9dap+4
+0x1.45ce08p+3
+-0x1.33222p+0
+-0x1.028c1cp+2
+-0x1.0f0e5cp+4
+-0x1.deeacp+2
+-0x1.02de5cp+3
+-0x1.513c6p+1
+-0x1.4af08p-1
+0x1.086f8p+4
+0x1.a2261p+3
+0x1.391728p+4
+0x1.f0f88p+0
+-0x1.968096p+3
+0x1.1611a4p+4
+0x1.c0b57p+3
+-0x1.36ba5p+3
+-0x1.7bacp-5
+-0x1.2ef69ep+4
+-0x1.048fep+2
+0x1.bf8b98p+3
+0x1.325a54p+4
+0x1.206e5p+2
+-0x1.ea23b6p+3
+0x1.3150ecp+3
+-0x1.2063ep+1
+0x1.a0f8dp+3
+0x1.73abcp+0
+0x1.1049cp+0
+-0x1.d3586p+1
+-0x1.27cc18p+2
+0x1.ba6ap-1
+0x1.63ccfp+1
+-0x1.bc6f4p+0
+-0x1.22c0bp+4
+-0x1.18872cp+4
+0x1.6df3dp+1
+0x1.6944c4p+3
+-0x1.ddbf22p+3
+-0x1.7a82cp+0
+-0x1.439ee2p+3
+-0x1.73d2fep+3
+-0x1.211e98p+3
+-0x1.5f885ap+3
+0x1.0f4e08p+3
+0x1.cb8c8p+3
+0x1.d869p+1
+-0x1.4a25bp+3
+0x1.fd608p-2
+0x1.d74f8p-2
+0x1.f4d118p+3
+-0x1.9ae6p+0
+-0x1.072e24p+4
+-0x1.cc707cp+3
+0x1.133c18p+3
+-0x1.90414p+0
+0x1.27941p+1
+0x1.59fb3cp+3
+-0x1.06e858p+2
+-0x1.fcaeap+0
+0x1.eb5dep+1
+-0x1.416c8p+0
+0x1.1c7b6cp+4
+-0x1.2a6e2cp+3
+0x1.2c761cp+4
+0x1.fd71cp+3
+0x1.35e09p+3
+-0x1.acb3a4p+2
+0x1.2e9948p+4
+-0x1.2ee254p+4
+-0x1.a1ea8p-1
+0x1.68304p+0
+0x1.ce08c8p+2
+0x1.d1176p+3
+-0x1.53cd4cp+2
+0x1.342a5p+2
+0x1.c558ap+2
+0x1.9ebf9p+3
+-0x1.9a7f1cp+2
+-0x1.e29dp-3
+-0x1.2ebe4p-1
+-0x1.1ea6b8p+4
+0x1.591968p+3
+0x1.93038p+3
+-0x1.362f32p+3
+0x1.56d2bp+2
+-0x1.6ec0d6p+3
+0x1.ca1f9p+3
+0x1.decdc8p+3
+-0x1.9fdf2p+1
+-0x1.784008p+2
+-0x1.b4c4acp+2
+-0x1.3727bp+4
+-0x1.1d152p+3
+-0x1.55e51cp+3
+-0x1.34c1e8p+3
+-0x1.4cfa88p+2
+-0x1.aa19cp+1
+0x1.600a1cp+3
+0x1.1c161cp+4
+0x1.df4bep+3
+0x1.ef037p+3
+-0x1.34b5ccp+3
+0x1.3a8154p+4
+0x1.014658p+3
+0x1.616fbp+2
+0x1.f607a8p+3
+-0x1.1eb464p+2
+-0x1.6a8d44p+3
+-0x1.302918p+4
+0x1.2637e4p+4
+0x1.1f8b3p+4
+0x1.a98fbp+2
+-0x1.d38cp+1
+0x1.1d0cep+3
+-0x1.8f8cc4p+2
+-0x1.62a05cp+2
+-0x1.06cadcp+3
+0x1.07a42cp+4
+0x1.2b4fep+4
+0x1.11db8p+3
+-0x1.3d2af8p+2
+-0x1.677808p+3
+0x1.ab9cp-3
+-0x1.5ade42p+3
+0x1.253aecp+4
+0x1.3f8ad4p+4
+0x1.338edcp+4
+-0x1.2ed73ap+3
+-0x1.1a20cp+4
+0x1.1f377p+1
+-0x1.c7d718p+2
+0x1.82abbp+3
+0x1.a93ffp+2
+-0x1.5a62ep+2
+-0x1.1175d8p+2
+-0x1.a801eep+3
+-0x1.0b381cp+4
+-0x1.10e558p+4
+0x1.3ecc98p+4
+-0x1.5825p+0
+0x1.863f9p+2
+0x1.6f04ap+1
+-0x1.1a1926p+3
+-0x1.a3151p+1
+0x1.911b9p+3
+-0x1.57857p+3
+0x1.0321f4p+4
+0x1.507c5p+1
+-0x1.1e125ep+4
+0x1.384f44p+4
+-0x1.23e7ap+4
+0x1.888bdp+3
+0x1.93c38p+3
+-0x1.f7861cp+3
+0x1.3d4364p+4
+-0x1.d93914p+3
+0x1.cdba88p+3
+-0x1.6ddaap+3
+0x1.a7cb2p+2
+0x1.847aa8p+3
+-0x1.bea42p+1
+-0x1.8412p+2
+0x1.2376p+3
+0x1.8abccp-1
+-0x1.25496p+1
+0x1.430848p+3
+-0x1.152338p+4
+0x1.12cc7p+2
+0x1.2d03fp+2
+0x1.2e46cp+3
+0x1.39566p+0
+0x1.6a4798p+3
+-0x1.f574dp+1
+-0x1.c8adfp+1
+-0x1.0a2ed4p+2
+0x1.1df95cp+4
+-0x1.0fabbp+1
+0x1.0baa1cp+3
+-0x1.197b5ep+4
+0x1.b094p-1
+-0x1.01ffp-3
+0x1.60a48p+1
+-0x1.05de5ap+4
+0x1.b893dp+1
+0x1.3cad2p+3
+0x1.126c88p+2
+-0x1.b64328p+3
+0x1.067a64p+4
+-0x1.92c75p+1
+-0x1.ad879cp+2
+0x1.78746p+0
+-0x1.3781f4p+2
+-0x1.34ffp+2
+0x1.d6e738p+3
+0x1.ccae18p+2
+0x1.2e8ff4p+4
+-0x1.12c228p+4
+-0x1.08a8c4p+4
+-0x1.ff6becp+2
+0x1.fd0368p+3
+-0x1.0ac648p+4
+0x1.414194p+3
+0x1.3882e8p+3
+0x1.0d717cp+4
+-0x1.a9c8d8p+2
+-0x1.e02b7p+3
+0x1.792808p+2
+0x1.334c7p+2
+0x1.37e894p+4
+0x1.8e95p-2
+-0x1.20ff7ep+4
+-0x1.caf154p+3
+-0x1.53509cp+2
+0x1.979b58p+3
+0x1.607b2p+1
+0x1.33468p+1
+-0x1.aa1a48p+3
+0x1.70cc2p+1
+-0x1.e591a4p+3
+0x1.43325p+3
+-0x1.637f0cp+3
+0x1.ac3e08p+2
+-0x1.3889fp+4
+0x1.17e4cp+4
+0x1.5632f8p+3
+0x1.2c0678p+3
+0x1.2dffd8p+4
+-0x1.11832ep+3
+-0x1.baf878p+3
+-0x1.07326ep+4
+0x1.00b694p+3
+-0x1.2d915p+3
+0x1.612204p+3
+-0x1.ffd36cp+2
+-0x1.48e0dp+3
+-0x1.9f771p+3
+-0x1.41d732p+3
+0x1.a3162p+1
+-0x1.7fefeep+3
+-0x1.611836p+3
+-0x1.7ca304p+3
+0x1.364dep+1
+-0x1.f328b6p+3
+-0x1.eb5cc4p+2
+0x1.cfbc6p+1
+0x1.56555cp+3
+-0x1.cb04p-5
+0x1.247b24p+4
+-0x1.bb4c18p+2
+-0x1.c0cf6p+3
+-0x1.b8f24p+1
+-0x1.24d9c4p+4
+0x1.2b53acp+4
+-0x1.fca186p+3
+0x1.17dbc4p+4
+0x1.bb3d68p+3
+-0x1.10c93p+1
+-0x1.21131ep+4
+-0x1.dbd96ap+3
+-0x1.3d496p+2
+-0x1.385aap+1
+-0x1.b22a3p+3
+0x1.0ff4fp+3
+-0x1.9ac55p+1
+-0x1.01c6eap+4
+-0x1.2a31e8p+4
+0x1.3558ap+2
+-0x1.670b7p+1
+0x1.f82af8p+3
+-0x1.93662p+0
+-0x1.066bc4p+2
+0x1.735ce8p+2
+0x1.aeedap+1
+-0x1.11b38cp+4
+0x1.ba702p+3
+0x1.0bf764p+4
+0x1.e3d2ep+0
+0x1.0b582p+2
+0x1.c5c058p+2
+-0x1.47cfp-1
+-0x1.6a194p-1
+-0x1.950ba4p+2
+-0x1.17ac8p+3
+-0x1.3e390ap+3
+-0x1.09821p+4
+-0x1.39ca94p+4
+-0x1.22d36ap+4
+-0x1.cb313p+3
+-0x1.050ef8p+4
+0x1.cc263p+3
+-0x1.032e6p+0
+-0x1.fb1102p+3
+-0x1.9aa74p-1
+-0x1.625p-3
+0x1.89c418p+3
+0x1.a8d2fp+3
+0x1.62a768p+2
+0x1.ee6728p+3
+-0x1.4a986cp+3
+0x1.4613e8p+2
+-0x1.1d5034p+3
+-0x1.7ce626p+3
+-0x1.e9f462p+3
+-0x1.ab207ep+3
+-0x1.e23f28p+3
+-0x1.40b06cp+2
+-0x1.ff6638p+3
+0x1.bfdb6p+1
+0x1.6e60d8p+2
+0x1.cc529p+3
+0x1.4167ecp+3
+0x1.0e29b8p+3
+0x1.d4f888p+3
+-0x1.ec6cbp+2
+0x1.2c792p+2
+-0x1.9dde1ep+3
+-0x1.618d6p+3
+-0x1.88a0bep+3
+-0x1.f14488p+3
+-0x1.ca6bap+3
+-0x1.5f8814p+3
+0x1.215de4p+3
+-0x1.32241cp+4
+0x1.1f2508p+4
+-0x1.8f06dap+3
+-0x1.054538p+4
+-0x1.0680c4p+3
+0x1.10439p+3
+-0x1.e1b68p+0
+0x1.cd0e88p+3
+-0x1.1592a8p+2
+-0x1.a754acp+3
+0x1.2bec94p+4
+0x1.70f58p+3
+-0x1.fb1e7cp+3
+0x1.71723p+3
+-0x1.2a1p-7
+0x1.c878fp+2
+-0x1.83fde8p+2
+-0x1.490f72p+3
+0x1.6ac254p+3
+0x1.f78218p+2
+-0x1.c104ecp+3
+0x1.ab7718p+2
+0x1.061ac4p+4
+0x1.1dfcf8p+2
+-0x1.0d3aa4p+4
+-0x1.09ddc4p+3
+0x1.05722p+1
+0x1.22f90cp+3
+-0x1.f3350ap+3
+0x1.c1d95p+2
+0x1.d134ep+3
+0x1.e630ap+3
+-0x1.f2fe6p+1
+-0x1.8208p-3
+-0x1.feedc8p+2
+-0x1.d65438p+3
+0x1.cd12c8p+3
+0x1.19a36p+2
+0x1.a3624p-1
+0x1.b0132p+2
+-0x1.a3bc68p+3
+-0x1.a62c86p+3
+-0x1.b5257ep+3
+0x1.3db9cp+1
+-0x1.24a36p+0
+-0x1.8c41dcp+3
+-0x1.bf138p+0
+0x1.0ca8ep+3
+-0x1.dd6254p+3
+-0x1.629638p+3
+0x1.17703p+2
+-0x1.0e91f6p+4
+-0x1.10c2ecp+4
+0x1.3108ep+0
+-0x1.b7d99p+3
+-0x1.163694p+4
+-0x1.63cdecp+2
+0x1.3875fp+1
+-0x1.8e3642p+3
+0x1.73de0cp+3
+-0x1.092a1ap+3
+0x1.554678p+3
+0x1.0b42ep+2
+-0x1.d66b86p+3
+0x1.a5a9c8p+2
+0x1.97605p+3
+0x1.a0bb4p+0
+-0x1.2f90cp-1
+-0x1.37a454p+2
+-0x1.8b46p-4
+0x1.216b84p+4
+0x1.19930cp+4
+0x1.04d39p+4
+-0x1.223f04p+4
+-0x1.5d7258p+2
+-0x1.fdee9p+2
+0x1.c6796p+2
+-0x1.5a64dep+3
+-0x1.94751ep+3
+0x1.6b029p+3
+0x1.3ad82cp+4
+0x1.16669p+2
+-0x1.2c3398p+3
+0x1.109ea8p+3
+-0x1.dec63ap+3
+0x1.2c17f8p+4
+-0x1.4d17f8p+3
+0x1.9f8ac8p+3
+0x1.4f1f58p+3
+0x1.93467p+3
+0x1.ea16c8p+2
+-0x1.207d1ep+4
+0x1.3248p-1
+0x1.c1c75p+3
+-0x1.f8a2cp+2
+-0x1.0a216p+1
+0x1.fb09dp+3
+-0x1.bf1268p+3
+-0x1.51c9e4p+3
+-0x1.9d29ep+3
+-0x1.43c7ep+0
+-0x1.0fa932p+4
+-0x1.67b4cp+1
+0x1.1d3bb8p+3
+0x1.3bb1f8p+3
+0x1.20a6fcp+3
+0x1.65ef1p+2
+-0x1.9aeep+1
+0x1.807c8p+1
+0x1.38814p+2
+-0x1.a9c314p+3
+-0x1.2337a2p+4
+0x1.cd515p+3
+0x1.9655ap+3
+0x1.d09898p+3
+0x1.d25bcp+3
+-0x1.3d9a24p+4
+0x1.2d1bbcp+4
+0x1.f0b688p+3
+0x1.7f3d1p+1
+0x1.0183cp+0
+-0x1.b25e58p+3
+-0x1.27daeep+4
+-0x1.1635fap+4
+-0x1.8dc5cp+1
+0x1.532e04p+3
+-0x1.068a64p+4
+0x1.188c04p+4
+0x1.108a3cp+4
+0x1.8cb84p+2
+-0x1.1afcap+4
+-0x1.3f64dep+4
+0x1.09106cp+4
+-0x1.ab759cp+2
+-0x1.daebfcp+3
+0x1.1585ap+1
+-0x1.76fcp-5
+-0x1.2b101cp+3
+0x1.a32f88p+2
+0x1.09988p+1
+-0x1.813c4cp+2
+-0x1.9cf78cp+2
+-0x1.20294p+3
+0x1.8bcaap+3
+-0x1.72461p+1
+-0x1.2ab636p+4
+-0x1.209602p+4
+0x1.27d37cp+4
+-0x1.a514ap+3
+0x1.31e58p-1
+0x1.6132ap+0
+-0x1.77f09ep+3
+-0x1.55dca2p+3
+0x1.efb2ap+2
+0x1.dcd1b8p+3
+-0x1.673234p+2
+-0x1.081d3cp+3
+0x1.24818p+1
+0x1.d8fd08p+2
+0x1.660298p+3
+-0x1.990a3p+2
+-0x1.1aad98p+4
+-0x1.f62b5cp+3
+0x1.670728p+3
+0x1.05fc2p+3
+-0x1.3c13p-1
+-0x1.f02d6p+3
+-0x1.986acp+0
+-0x1.b0d24cp+3
+-0x1.7c816p+2
+-0x1.12493p+2
+0x1.3ecf18p+3
+0x1.1c684p+2
+0x1.ff133p+2
+0x1.a2749p+3
+-0x1.3672e2p+4
+0x1.9f4efp+3
+0x1.eca91p+2
+0x1.13a478p+4
+-0x1.da6926p+3
+-0x1.2d60dap+3
+-0x1.314c8ep+3
+0x1.67725cp+3
+-0x1.7aae38p+3
+-0x1.4423c4p+3
+-0x1.0fe384p+2
+-0x1.100ccp-1
+-0x1.4bb77p+3
+0x1.03f2c4p+4
+0x1.3711d8p+4
+-0x1.7abd8p-1
+0x1.da70b8p+2
+-0x1.e17ee8p+2
+-0x1.52951p+2
+0x1.47082p+2
+0x1.9618cp+0
+-0x1.2c7a4cp+4
+0x1.bb538p+2
+-0x1.26c558p+4
+0x1.a03cp+0
+0x1.b10d68p+2
+0x1.d0d09p+1
+-0x1.e9cedp+2
+0x1.7b275p+3
+0x1.28edc4p+4
+-0x1.dc2fe8p+3
+0x1.1954e8p+4
+0x1.5a0acp+0
+-0x1.8ed08p+0
+0x1.0e8cbp+4
+-0x1.25b558p+2
+-0x1.51f0cap+3
+-0x1.974f52p+3
+-0x1.b10c9p+2
+-0x1.5f5fap+1
+-0x1.101f38p+4
+-0x1.c684fp+2
+-0x1.04614p+0
+-0x1.d1d47ap+3
+0x1.15ae34p+4
+0x1.7ec268p+2
+-0x1.e69aap+1
+-0x1.ac4c9cp+3
+0x1.26cebp+3
+-0x1.aa02ap+0
+-0x1.11f894p+3
+-0x1.d6f856p+3
+-0x1.27908p+1
+-0x1.1fe5fep+3
+-0x1.34be68p+3
+0x1.f92e4p+0
+0x1.932fdp+2
+0x1.443acp-1
+0x1.9dffap+1
+-0x1.62f4p-4
+-0x1.079448p+4
+0x1.a025dp+2
+0x1.12bca8p+2
+-0x1.6ffdbep+3
+0x1.087c5p+2
+0x1.069cfcp+4
+0x1.2c7b5cp+4
+-0x1.4ad3cp+1
+0x1.b2f88p-1
+-0x1.91a6ap+0
+-0x1.2a78d2p+3
+-0x1.87579p+1
+0x1.defb68p+3
+0x1.4c5cacp+3
+0x1.5ee82p+1
+-0x1.13491cp+2
+-0x1.927588p+3
+-0x1.30f1ep+4
+-0x1.5d959p+2
+-0x1.06308p+2
+-0x1.ad78dap+3
+-0x1.b24a08p+2
+-0x1.0d525p+3
+-0x1.96b2f8p+3
+-0x1.7f9184p+2
+-0x1.14e308p+3
+0x1.bb2a68p+3
+-0x1.10984p+0
+-0x1.078992p+4
+0x1.4e4178p+3
+-0x1.4c45dp+1
+0x1.61408p+3
+0x1.d18388p+3
+0x1.09656cp+4
+-0x1.1f058ep+4
+-0x1.25af1cp+4
+-0x1.0b159p+4
+0x1.2dfefp+2
+-0x1.a15ee8p+3
+-0x1.5dd91ap+3
+0x1.a798f8p+3
+0x1.5f804p+0
+-0x1.93decp+1
+0x1.3e5b4cp+3
+0x1.b85d2p+2
+0x1.d40e7p+1
+0x1.201794p+4
+-0x1.13ccb6p+4
+0x1.366ab8p+3
+-0x1.9e2f6p+1
+0x1.f1389p+3
+-0x1.46d9e8p+3
+0x1.73d614p+3
+0x1.eb7028p+3
+-0x1.e1c8p+2
+-0x1.19638p-2
+-0x1.270366p+4
+-0x1.a02e28p+3
+0x1.c9cc4p+3
+0x1.019ee8p+2
+0x1.b39a8p+3
+-0x1.9af1f4p+3
+0x1.f5023p+1
+-0x1.e7746p+3
+0x1.3b5f3p+4
+-0x1.8e4e4p+0
+0x1.49833p+3
+-0x1.bb951ap+3
+-0x1.1cec7ap+4
+-0x1.d25b3cp+3
+-0x1.31c36ep+4
+0x1.d522d8p+3
+-0x1.d2938p-1
+0x1.05b9fp+2
+0x1.7967a4p+3
+-0x1.3e33e8p+4
+-0x1.83457cp+3
+-0x1.1c85dp+1
+0x1.af2e4p-1
+-0x1.7faf44p+2
+0x1.a646cp-1
+-0x1.24368ep+4
+0x1.0ce3f8p+3
+-0x1.b47778p+3
+-0x1.e0ff8p-2
+-0x1.d5411p+3
+0x1.2eaec8p+4
+-0x1.56345cp+3
+-0x1.87282p+3
+-0x1.6c332p+1
+0x1.2e1f38p+4
+0x1.dcd4p-3
+-0x1.b91f58p+2
+-0x1.720c9p+1
+0x1.5a877cp+3
+0x1.d5f14p+1
+-0x1.cc1fcp+3
+0x1.c73f38p+3
+-0x1.f815e4p+3
+0x1.34fec8p+2
+-0x1.de3758p+3
+-0x1.033fdp+3
+-0x1.4af37p+1
+-0x1.ed2a9cp+3
+0x1.3bce5p+4
+0x1.cc3f4p+3
+0x1.4c7f5p+3
+-0x1.8b48e8p+2
+-0x1.5fa2b8p+2
+0x1.13392cp+4
+-0x1.e33a52p+3
+-0x1.38818p-2
+-0x1.25d98ap+3
+-0x1.ecc21ep+3
+-0x1.7866f8p+2
+-0x1.af5af4p+2
+0x1.063d4p+1
+-0x1.ae60dcp+2
+0x1.29ade8p+4
+0x1.b04548p+3
+-0x1.aa017p+1
+-0x1.084576p+4
+-0x1.09808p-1
+0x1.247be8p+2
+0x1.217548p+3
+-0x1.64ae4cp+3
+-0x1.ef30c4p+3
+-0x1.a9874p+1
+0x1.8828d8p+2
+-0x1.e769eep+3
+0x1.236e4p+0
+0x1.a3f3ep+3
+0x1.bfcb8p+2
+-0x1.35ae4p+2
+-0x1.42cd18p+2
+-0x1.53172p+3
+-0x1.098abcp+4
+-0x1.e6abd8p+3
+-0x1.1bc3f4p+3
+0x1.134e4p+0
+-0x1.627188p+2
+-0x1.86fep-3
+-0x1.1669d4p+3
+0x1.8226p+3
+0x1.8c45a8p+3
+0x1.323f88p+3
+0x1.d33a58p+2
+0x1.2725ep+4
+-0x1.6389bcp+2
+-0x1.e7511cp+2
+-0x1.bf0a0cp+3
+0x1.a70278p+2
+0x1.9278bp+2
+0x1.98d768p+3
+0x1.65d758p+3
+-0x1.e2adfp+3
+0x1.edef4p+2
+-0x1.03cc3p+3
+-0x1.525952p+3
+0x1.9a09fp+3
+0x1.902p-6
+0x1.4e1718p+3
+-0x1.32735ep+3
+0x1.97a1e8p+2
+0x1.03c284p+3
+-0x1.27f718p+3
+-0x1.9d9188p+2
+-0x1.bd74f4p+2
+0x1.2d9ff4p+4
+-0x1.f8bdcp+0
+-0x1.170224p+4
+-0x1.ade7cp-1
+0x1.f64fb8p+2
+-0x1.09b0dcp+3
+0x1.c5cbe8p+3
+-0x1.192c62p+4
+0x1.3d8318p+2
+-0x1.25a1c8p+4
+-0x1.026eap+1
+-0x1.aadc4cp+3
+0x1.35d5bp+2
+0x1.604f6p+2
+-0x1.5b3cp-4
+0x1.e6e378p+3
+0x1.80d4fp+1
+0x1.47c13p+3
+-0x1.11d95cp+4
+0x1.2ad474p+4
+-0x1.1d75aep+4
+-0x1.1919eep+4
+0x1.4edacp-1
+-0x1.001a56p+3
+0x1.3eef54p+3
+-0x1.2d4bb6p+3
+-0x1.8aadc8p+2
+-0x1.961b08p+2
+-0x1.c8d7a8p+2
+-0x1.6324d4p+3
+-0x1.06fe24p+3
+-0x1.17101ep+3
+-0x1.234c7p+3
+0x1.207d68p+2
+0x1.f7d2p-4
+-0x1.96bbc8p+3
+0x1.fda688p+3
+-0x1.fd476p+0
+0x1.2a1978p+2
+0x1.df8a8p+1
+0x1.7def58p+2
+0x1.3b10dp+4
+-0x1.97de6p+1
+0x1.3b2ff8p+2
+0x1.65326p+3
+0x1.9c97e8p+2
+-0x1.23246p+3
+0x1.adfe68p+2
+0x1.9cf08p-2
+0x1.19ca1p+4
+0x1.035f7p+1
+0x1.0de5d8p+4
+-0x1.272888p+3
+0x1.154c9p+4
+0x1.5614cp+2
+-0x1.94256p+2
+-0x1.909406p+3
+0x1.19d714p+3
+-0x1.88d0fp+3
+0x1.65c05p+2
+-0x1.668106p+3
+-0x1.a0a92cp+3
+0x1.ed168p+0
+0x1.8b63f8p+3
+-0x1.ae89f6p+3
+-0x1.c6cc5cp+2
+0x1.6cf43p+2
+0x1.35178p-2
+-0x1.b627bp+2
+0x1.05f95cp+4
+-0x1.93d994p+3
+0x1.4e417p+3
+-0x1.59c6dp+1
+-0x1.0b8dbp+1
+-0x1.6065ep+3
+-0x1.810ea8p+2
+0x1.6f65p-2
+-0x1.3d9a44p+3
+-0x1.5b5588p+3
+0x1.b3e9e8p+3
+-0x1.3eab1ap+3
+-0x1.52f9c4p+3
+0x1.d090dp+1
+-0x1.7047p-2
+-0x1.245bc4p+2
+-0x1.0155ap+4
+0x1.8df128p+2
+-0x1.0b3b0cp+4
+0x1.5d2f98p+3
+-0x1.024fap+0
+0x1.41ef2p+0
+0x1.f762d8p+3
+-0x1.85876ap+3
+0x1.82df2p+3
+-0x1.f241c4p+2
+-0x1.bb4bfp+2
+-0x1.bb70c6p+3
+0x1.0b9ac4p+4
+-0x1.22003cp+4
+0x1.855608p+3
+0x1.a8a17p+2
+-0x1.00c3b4p+3
+-0x1.1831e8p+4
+-0x1.d1621p+2
+-0x1.be78a2p+3
+-0x1.e1bf4ap+3
+0x1.153b24p+4
--
2.43.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 05/11] benchtests: Add tanf benchmark
2024-11-11 13:45 [PATCH 00/11] Add more CORE-math implementations to libm Adhemerval Zanella
` (3 preceding siblings ...)
2024-11-11 13:45 ` [PATCH 04/11] benchtests: Add lgammaf benchmark Adhemerval Zanella
@ 2024-11-11 13:45 ` Adhemerval Zanella
2024-11-20 21:46 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 06/11] math: Use cbrtf from CORE-MATH Adhemerval Zanella
` (5 subsequent siblings)
10 siblings, 1 reply; 34+ messages in thread
From: Adhemerval Zanella @ 2024-11-11 13:45 UTC (permalink / raw)
To: libc-alpha
---
benchtests/Makefile | 1 +
benchtests/tanf-inputs | 3005 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 3006 insertions(+)
create mode 100644 benchtests/tanf-inputs
diff --git a/benchtests/Makefile b/benchtests/Makefile
index 0db303a84a..23db840666 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -103,6 +103,7 @@ bench-math := \
sinh \
sqrt \
tan \
+ tanf \
tanh \
tgamma \
tgammaf \
diff --git a/benchtests/tanf-inputs b/benchtests/tanf-inputs
new file mode 100644
index 0000000000..2d8e8d13c6
--- /dev/null
+++ b/benchtests/tanf-inputs
@@ -0,0 +1,3005 @@
+## args: float
+## ret: float
+## includes: math.h
+# Random inputs in [-pi, pi]
+## name: workload-random
+-0x1.8d3888p+0
+0x1.83287ep+1
+-0x1.92ff9ep+0
+0x1.65a558p-1
+-0x1.9049aap+1
+-0x1.9f0608p-1
+-0x1.afc666p+0
+0x1.588372p+1
+-0x1.5a08b4p+1
+-0x1.15d598p+1
+-0x1.8d8ba8p-1
+0x1.1f122p-2
+-0x1.57b29p-1
+0x1.29f8a6p+1
+-0x1.7f362p-2
+-0x1.b5be2p-3
+0x1.a06f0cp+0
+0x1.b65444p+0
+0x1.66cfap-2
+0x1.db3a44p+0
+-0x1.3f4d5ap+1
+0x1.d39cdcp+0
+0x1.d583p-3
+0x1.791eb4p+0
+0x1.86b1a2p+1
+-0x1.22e364p+1
+0x1.fc71ep-2
+0x1.14a76cp+0
+-0x1.b40354p+0
+0x1.d583a8p-1
+-0x1.2ea72p-2
+0x1.441d42p+1
+0x1.b5163cp+0
+0x1.e122p-2
+-0x1.178d48p+0
+-0x1.8dd9p-5
+0x1.26afdp-1
+-0x1.554b4p+1
+-0x1.d10056p+0
+0x1.92b114p+0
+-0x1.fc76b8p+0
+0x1.74796p-1
+-0x1.6e2a8p-3
+-0x1.984c9cp+0
+-0x1.bbd27cp+0
+-0x1.6afd18p+1
+0x1.115c42p+1
+-0x1.2b6cc8p+1
+-0x1.00c9ccp+1
+-0x1.eea28ep+0
+-0x1.38a48ap+1
+0x1.70707ep+1
+-0x1.59dc2ep+1
+0x1.d0d38cp+0
+-0x1.fea69p-2
+0x1.ac3f3p-2
+-0x1.048e64p+1
+-0x1.397e8p-2
+0x1.0bba78p-1
+-0x1.ad683p+0
+0x1.13fa1cp+0
+-0x1.15c1eep+1
+0x1.834a7ap+1
+-0x1.7ea8eap+1
+0x1.9afb44p+0
+0x1.e5c56cp+0
+-0x1.6f9a3p+0
+-0x1.e40c2p-3
+-0x1.614638p+0
+-0x1.0646ep+1
+-0x1.4d008p-5
+0x1.ab2524p+0
+0x1.38f27cp+0
+-0x1.3041ep-2
+0x1.5559acp+0
+-0x1.ae901ep+0
+0x1.2adf3p-1
+0x1.61eb36p+1
+0x1.80ec9p-1
+0x1.9e5ap-4
+-0x1.45ba2cp+1
+0x1.0dcfap-3
+0x1.44d9fep+1
+-0x1.023eap+1
+0x1.9f8dfcp+0
+0x1.17367p-1
+-0x1.aea13p+0
+0x1.3e8622p+1
+0x1.677406p+1
+-0x1.661932p+0
+0x1.ad7974p+0
+-0x1.77a1e2p+1
+0x1.6ea918p-1
+-0x1.43097p+1
+0x1.877744p+0
+0x1.362cbap+1
+-0x1.b51b2p-3
+0x1.241a98p-1
+0x1.06d398p-1
+0x1.8d44ep-1
+-0x1.891962p+1
+0x1.3660f8p-1
+-0x1.63f09ap+1
+-0x1.1e56a4p+1
+0x1.009c54p+0
+0x1.de1e94p+0
+-0x1.22098p+0
+0x1.5bb7c6p+1
+-0x1.75c332p+1
+0x1.32405cp+0
+-0x1.2996cp-4
+-0x1.137d3cp+1
+-0x1.71c818p-1
+0x1.3346f8p-1
+0x1.1c49c2p+1
+-0x1.729ap-5
+-0x1.37358p-4
+-0x1.7ccc5p+0
+0x1.04e2b8p-1
+-0x1.b15ap-4
+-0x1.f656p-7
+-0x1.4dc88p-5
+0x1.066d8p-4
+0x1.314c66p+1
+0x1.9091ap-2
+0x1.2e2a86p+1
+-0x1.3f5e7cp+1
+-0x1.5997c8p-1
+0x1.78a606p+1
+0x1.876a88p-1
+-0x1.af444p-2
+0x1.5dfea6p+1
+0x1.728b38p-1
+-0x1.6d06ap-1
+-0x1.77d55p-2
+0x1.81476cp+0
+-0x1.a14cd8p+0
+-0x1.05e328p+1
+0x1.aee928p-1
+0x1.b322d4p+0
+-0x1.f0313ep+0
+0x1.10385ep+1
+-0x1.40ca5cp+0
+0x1.2e219p-1
+0x1.78bc92p+1
+-0x1.f0652p-3
+-0x1.17953ep+1
+0x1.0c84f2p+1
+0x1.723b32p+1
+0x1.63184p-4
+-0x1.4d0988p-1
+0x1.9f076p-2
+0x1.dd7a68p-1
+-0x1.620a78p+1
+0x1.078b42p+1
+0x1.87f9aep+1
+0x1.4fc952p+1
+0x1.370254p+0
+-0x1.e0af58p+0
+0x1.2cbb3ep+1
+-0x1.2f89d4p+1
+-0x1.c521c2p+0
+0x1.b6a224p+0
+0x1.78e504p+0
+0x1.a884p-1
+-0x1.c4a1fp-1
+0x1.89aaecp+0
+0x1.3c010ap+1
+-0x1.58bd38p+0
+-0x1.cc55d8p-1
+0x1.e724p-7
+-0x1.780a22p+0
+-0x1.3ea37ep+0
+-0x1.5341d4p+1
+0x1.baf4c4p+0
+0x1.433496p+1
+0x1.bf1c2cp+0
+-0x1.381bf8p+0
+-0x1.3c3b0ep+0
+-0x1.a3ce9ep+0
+0x1.81d29ap+1
+-0x1.013664p+0
+0x1.4d0716p+1
+-0x1.7034bp+1
+0x1.f666a4p+0
+-0x1.76268ap+1
+0x1.0399cp-1
+0x1.b125bcp+0
+-0x1.1d1038p-1
+-0x1.e0da58p+0
+-0x1.32c268p+1
+0x1.4714b2p+1
+0x1.ae182cp+0
+0x1.0fc04p-4
+0x1.792456p+1
+0x1.5c302ep+1
+0x1.24505ap+1
+-0x1.cc0b7ap+0
+0x1.00fdep-2
+0x1.01758ap+1
+0x1.068c26p+1
+-0x1.0f6a0ep+1
+0x1.0bdddp-2
+-0x1.b7339ep+0
+-0x1.13f894p+0
+0x1.483b5ap+1
+0x1.01550ep+1
+-0x1.057ab6p+1
+-0x1.118614p+1
+-0x1.0b2e7p-2
+0x1.90891p-2
+0x1.cfe154p+0
+0x1.cc9b6p-3
+-0x1.3e7cep+1
+0x1.f0b4f4p+0
+0x1.e3e2p-3
+0x1.12468p-5
+-0x1.6327fap+1
+0x1.1524p-3
+-0x1.2dfc6p-3
+-0x1.577502p+1
+-0x1.8c9d94p+1
+-0x1.37f76p+1
+-0x1.4685ap+1
+0x1.4c153ap+1
+-0x1.43356ep+0
+-0x1.17232p+0
+0x1.053836p+1
+-0x1.1b69ap-1
+0x1.05c8bep+1
+-0x1.d31fbep+0
+0x1.c4ff3p-2
+0x1.08c54ap+1
+0x1.86c638p-1
+-0x1.517beap+1
+0x1.093db6p+1
+-0x1.34297p-2
+0x1.3a7bcp-4
+0x1.2d3d7ep+1
+0x1.9a1ae4p+0
+0x1.cffac8p-1
+0x1.e7618p-3
+-0x1.569ea6p+1
+0x1.10fe8p-5
+0x1.c10668p-1
+-0x1.26dc78p-1
+-0x1.876948p+1
+0x1.296662p+1
+0x1.7524p-8
+0x1.724874p+0
+0x1.377a1p-2
+-0x1.1c56fp+1
+-0x1.baa93p-2
+-0x1.08bc84p+1
+-0x1.460598p+1
+-0x1.b4f9a8p-1
+0x1.27c52p-2
+-0x1.337d9ep+1
+0x1.906a88p-1
+-0x1.2df3cp-2
+0x1.775074p+0
+-0x1.31e822p+1
+0x1.695facp+0
+-0x1.17333p-2
+-0x1.0b2f6ap+1
+0x1.517d02p+1
+-0x1.83d08ep+0
+-0x1.78f3d6p+0
+0x1.a6de4cp+0
+-0x1.8c2f86p+1
+-0x1.44cdcp+1
+0x1.018b7ep+1
+0x1.7e0cdp-1
+-0x1.f1ap-11
+0x1.72a606p+1
+-0x1.aa3c06p+0
+0x1.01ec72p+1
+0x1.a13d2p-3
+-0x1.fc874p-3
+-0x1.39f138p+0
+-0x1.19148cp+1
+0x1.1a52ap-2
+0x1.89b166p+1
+0x1.f667bcp+0
+-0x1.52cb94p+1
+-0x1.cc558p-2
+-0x1.8e998p+1
+0x1.dfe878p-1
+0x1.9990ecp+0
+-0x1.883606p+1
+-0x1.146b4ep+1
+0x1.6a5116p+1
+-0x1.32d81p+1
+-0x1.2262f2p+1
+-0x1.5e9126p+1
+-0x1.e11aep-2
+0x1.8c3c7cp+0
+0x1.7458ccp+0
+-0x1.365628p+1
+-0x1.1786dap+1
+-0x1.8b321cp+1
+0x1.c62694p+0
+0x1.2bb5d2p+1
+0x1.c46ee4p+0
+0x1.574942p+1
+-0x1.f3f95p-2
+-0x1.16b84p-2
+-0x1.f7d51p-2
+-0x1.88cd9p-1
+-0x1.1f9aa8p+0
+-0x1.d1de2p-1
+0x1.3d36f8p-1
+0x1.b61f64p+0
+-0x1.4d5f88p-1
+0x1.f22a2cp+0
+0x1.b50e74p+0
+-0x1.8714e4p+0
+-0x1.29cde6p+1
+-0x1.6b22c4p+1
+0x1.a9994cp+0
+0x1.e4ed6p-3
+0x1.296972p+1
+0x1.93ba94p+0
+-0x1.81dbb4p+1
+0x1.4ef462p+1
+-0x1.2f552ep+0
+-0x1.8b78cep+1
+-0x1.88c5fap+1
+-0x1.30885p-1
+-0x1.634f4p-4
+-0x1.e1062p-3
+-0x1.b3a68ap+0
+-0x1.acca6p-2
+-0x1.3747dp-1
+-0x1.b0bcccp+0
+0x1.2ab85ep+1
+-0x1.48c3fcp+1
+-0x1.7cfc46p+1
+0x1.8c40fcp+0
+0x1.4de6cep+1
+-0x1.3805c4p+0
+-0x1.d382cep+0
+0x1.5e254p-3
+0x1.08ecc6p+1
+0x1.154632p+1
+0x1.508362p+1
+0x1.3304bep+1
+0x1.cbfdp-5
+0x1.4001b4p+0
+-0x1.c9b23cp+0
+-0x1.51a9ep+1
+-0x1.537f3cp+1
+0x1.a66c04p+0
+-0x1.f87c98p-1
+0x1.0e2946p+1
+-0x1.6e119ap+0
+-0x1.64ba4p-4
+0x1.dca3ap-3
+-0x1.6e97b4p+1
+0x1.48892p-3
+0x1.4eaf78p-1
+-0x1.6cce14p+1
+0x1.33657ep+1
+-0x1.2c137p-1
+0x1.b15754p+0
+-0x1.9a6b3p-2
+-0x1.534e38p-1
+0x1.fcce1cp+0
+0x1.6b22d6p+1
+-0x1.9fc46p+0
+-0x1.ed47f4p+0
+-0x1.8553eap+0
+-0x1.231aap-2
+-0x1.59083cp+1
+-0x1.49398ap+1
+-0x1.bfa1dp-2
+-0x1.fa8f16p+0
+0x1.e58c4p-4
+0x1.20ef88p-1
+-0x1.7adbb2p+1
+-0x1.e006c2p+0
+0x1.99cf84p+0
+0x1.b20e4p-2
+-0x1.e196b8p-1
+-0x1.c3e0ep-3
+-0x1.47bedcp+0
+0x1.52a4fep+1
+-0x1.fa194p-2
+-0x1.11d9cp-2
+-0x1.206cb2p+1
+-0x1.5f1388p+1
+0x1.c4a534p+0
+-0x1.1e8f64p+1
+-0x1.7c7642p+1
+0x1.2c2a94p+0
+0x1.46a736p+1
+0x1.08916ap+1
+-0x1.6ceea8p-1
+0x1.5a8e3ap+1
+0x1.8a4564p+0
+-0x1.e825c4p+0
+0x1.40064ep+1
+-0x1.362c4p+0
+0x1.d92cp-3
+0x1.825d8p-4
+0x1.fffe74p+0
+-0x1.713aacp+0
+-0x1.da172p-3
+-0x1.594eep+0
+-0x1.1b9d78p-1
+0x1.aea744p+0
+-0x1.de2388p-1
+-0x1.230c4p-4
+-0x1.c6fa2p-2
+0x1.90badep+1
+0x1.29fa22p+1
+0x1.8d3c8p-2
+-0x1.0945d4p+1
+0x1.36444ep+1
+-0x1.5ef66p-1
+0x1.4de882p+1
+-0x1.69178p-2
+-0x1.962a7ap+0
+0x1.8109cp-4
+0x1.6b1a3ep+1
+0x1.fe348p-3
+0x1.35390ap+1
+0x1.d37fbp-2
+0x1.534554p+0
+0x1.0864p-5
+0x1.0a0e2ep+1
+-0x1.8bc1cp-3
+0x1.38e5c8p-1
+-0x1.c6e598p+0
+-0x1.0ffc08p+0
+0x1.92e41p-2
+0x1.62ee72p+1
+0x1.c676a4p+0
+-0x1.210dd2p+1
+0x1.4a7076p+1
+0x1.6b277ap+1
+0x1.805b2p-1
+0x1.3318dp-2
+0x1.4aff14p+0
+-0x1.6d7824p+1
+0x1.9177bap+1
+-0x1.57353ep+0
+-0x1.ceff2p-1
+0x1.3dfb6p-1
+0x1.c2b0acp+0
+0x1.57f594p+0
+-0x1.0de18p-5
+-0x1.8d8aa8p-1
+0x1.9d4f6p-2
+-0x1.12bbd4p+1
+-0x1.06f508p+1
+-0x1.67c9b8p+0
+-0x1.36e294p+1
+0x1.30eedcp+0
+0x1.5730fcp+0
+-0x1.8703ap-3
+0x1.d4effcp+0
+-0x1.883f08p-1
+-0x1.b19d2cp+0
+0x1.57249cp+0
+0x1.75a2b6p+1
+0x1.fc81b8p-1
+-0x1.0c1cd8p+1
+0x1.e162ap-3
+-0x1.9c93aap+0
+0x1.6bf52p-3
+0x1.28c152p+1
+-0x1.7cda0cp+1
+0x1.038d9p-2
+0x1.19334p-4
+-0x1.222754p+1
+0x1.5a398ep+1
+0x1.0b8b8ep+1
+0x1.484a2p-1
+0x1.a76918p-1
+0x1.13d978p-1
+0x1.028cf4p+0
+-0x1.5add6cp+1
+0x1.d2a224p+0
+-0x1.3e6f2p+0
+-0x1.c91bdep+0
+-0x1.c6384p+0
+-0x1.2e92bp-1
+0x1.66db3cp+0
+-0x1.17685p+1
+0x1.723ep-7
+0x1.6708dcp+0
+-0x1.85cff2p+1
+-0x1.5a770ap+0
+-0x1.1bdbap+0
+-0x1.1edap-7
+-0x1.4eccc2p+1
+0x1.54b37ap+1
+-0x1.433328p-1
+0x1.71900ep+1
+0x1.1b0f8p-2
+0x1.4f4f92p+1
+0x1.9a1da4p+0
+0x1.9d74a4p+0
+0x1.f2eda8p-1
+-0x1.2dd428p+1
+0x1.67767ep+1
+-0x1.0a486p-3
+0x1.49c364p+0
+-0x1.10449p+1
+0x1.493a1cp+0
+0x1.7901fp-2
+-0x1.142de8p+0
+0x1.73559cp+0
+0x1.ae83p-3
+0x1.dd2eacp+0
+0x1.65bcap-3
+0x1.889fdcp+0
+0x1.8c0df6p+1
+-0x1.0df3ep+1
+-0x1.4c233p+1
+0x1.88f44p-2
+0x1.8531a6p+1
+0x1.d85774p+0
+0x1.688832p+1
+0x1.03bffap+1
+0x1.3f922cp+0
+0x1.0700f4p+0
+0x1.3b23d8p-1
+0x1.5c1352p+1
+0x1.818ep-5
+-0x1.563468p-1
+0x1.11206cp+0
+-0x1.9f4708p-1
+0x1.45b2d2p+1
+0x1.308a1ap+1
+0x1.43022cp+0
+0x1.0550ep-1
+0x1.742c84p+0
+-0x1.38994p+0
+-0x1.f34f5p+0
+-0x1.7af8d4p+0
+0x1.043114p+0
+-0x1.c8bf0cp+0
+-0x1.8d17bep+1
+-0x1.222d6p+1
+-0x1.973b6p-2
+0x1.6041c4p+0
+-0x1.e9dbcep+0
+-0x1.82f814p+1
+0x1.459eb4p+0
+0x1.289acep+1
+0x1.33d0f2p+1
+-0x1.028bdap+1
+-0x1.28a13p-2
+0x1.b88298p-1
+0x1.529e3ap+1
+0x1.2897aap+1
+0x1.970228p-1
+0x1.3d3542p+1
+-0x1.55e99p-2
+-0x1.e60b58p-1
+-0x1.f71b84p+0
+0x1.0ad198p-1
+-0x1.02ff2p-3
+-0x1.c0437ap+0
+0x1.c5feb8p-1
+-0x1.98eca8p-1
+-0x1.44c028p+1
+0x1.59a076p+1
+-0x1.073204p+0
+-0x1.431cep-1
+-0x1.1449b8p-1
+-0x1.6b8e0ap+1
+-0x1.8bf498p+1
+0x1.46f3bap+1
+-0x1.55f7e2p+1
+-0x1.32e8f8p+1
+0x1.9f72f4p+0
+-0x1.b8198p-4
+-0x1.4978acp+1
+-0x1.67640cp+0
+-0x1.7cfeb2p+0
+0x1.35b5p-3
+-0x1.88b8c4p+1
+-0x1.9e0c4p-4
+-0x1.3ef8bap+1
+0x1.3fe854p+0
+-0x1.0187c6p+1
+0x1.290014p+0
+0x1.05d9a6p+1
+0x1.23a89p-1
+-0x1.8aa364p+0
+0x1.776a6ap+1
+0x1.20341ep+1
+-0x1.247ee4p+0
+-0x1.9c53d8p+0
+-0x1.26f338p+1
+0x1.3aa62cp+0
+-0x1.a969c8p+0
+-0x1.3ac76p-1
+0x1.6dcbcap+1
+0x1.083d92p+1
+0x1.1386fp-2
+-0x1.a51422p+0
+0x1.375144p+0
+-0x1.edbfap-2
+0x1.5f0664p+0
+-0x1.1d7a9cp+0
+0x1.83f9cp-2
+0x1.811426p+1
+0x1.d7f1fcp+0
+0x1.ecca1cp+0
+0x1.53685p-1
+0x1.5c21acp+0
+-0x1.4ab698p+1
+-0x1.1b22e8p+0
+-0x1.7332ccp+1
+-0x1.6c6fe8p+0
+0x1.c2138p-3
+-0x1.e223bp-1
+0x1.1c443p-1
+0x1.b0b8ap-1
+-0x1.b2b668p+0
+-0x1.aaf8aap+0
+-0x1.306fd2p+1
+-0x1.67951p-2
+-0x1.f0cce2p+0
+-0x1.7184cp-4
+-0x1.fc209ap+0
+-0x1.291c1p+1
+0x1.a8f42p-2
+0x1.dbb61p-2
+-0x1.0e735p+1
+0x1.27d2f4p+0
+0x1.bdbb8p-3
+0x1.1c27c4p+0
+0x1.60925p-1
+-0x1.c6ee8p-5
+0x1.6b90aap+1
+-0x1.d71d0cp+0
+0x1.35a04ep+1
+-0x1.9077a6p+1
+0x1.78f8f8p-1
+0x1.7c6b3ep+1
+-0x1.147f48p-1
+0x1.6dfc86p+1
+0x1.ef3024p+0
+0x1.0e6f84p+0
+-0x1.8d2d68p+0
+-0x1.9cebap-2
+0x1.213272p+1
+-0x1.52e88cp+1
+-0x1.5f05p+1
+0x1.78472ap+1
+0x1.2fd036p+1
+0x1.5af64p-3
+0x1.12826cp+0
+0x1.023422p+1
+-0x1.72dp-1
+-0x1.d3ad7ap+0
+0x1.cb0c3cp+0
+-0x1.700fa8p+1
+0x1.0dcc0ep+1
+0x1.05276cp+0
+-0x1.707876p+0
+-0x1.60c1ap-1
+0x1.1648fp-2
+-0x1.767f2p-2
+-0x1.b13b98p+0
+0x1.3bcdf4p+0
+-0x1.360692p+0
+-0x1.56696cp+1
+0x1.19d2a2p+1
+0x1.7c1ec2p+1
+-0x1.082448p+1
+0x1.1389p-3
+-0x1.8375e8p-1
+-0x1.ae1abep+0
+-0x1.765778p-1
+0x1.b5091cp+0
+-0x1.72fd3ep+1
+0x1.d3c378p-1
+-0x1.387ccep+0
+-0x1.dfeb8p-1
+-0x1.fcc094p+0
+0x1.465638p-1
+-0x1.c6762p-2
+-0x1.f24a5p-1
+-0x1.d4ee86p+0
+0x1.24297cp+0
+-0x1.6fc2ecp+0
+0x1.e20524p+0
+-0x1.53f9p+1
+0x1.03ebc2p+1
+-0x1.6d1f8ap+0
+-0x1.af2e7p-1
+0x1.fb5b7cp+0
+0x1.0492bap+1
+0x1.443502p+1
+0x1.533b1cp+0
+-0x1.4c064p+1
+0x1.54c252p+1
+0x1.6665b8p-1
+0x1.587966p+1
+-0x1.91f276p+0
+0x1.36c4f8p-1
+-0x1.436e84p+1
+-0x1.8ece8p-5
+-0x1.63fa28p+0
+0x1.5b442ep+1
+0x1.3e3738p-1
+-0x1.917f6ep+1
+-0x1.4e678p+1
+-0x1.f348b6p+0
+0x1.b1a2cp-3
+0x1.2f3e0ap+1
+0x1.322fdp-1
+-0x1.139e9ep+1
+0x1.01176cp+0
+0x1.033716p+1
+0x1.37f0ep-3
+0x1.5a1e4ap+1
+0x1.5bf9f8p-1
+-0x1.826p-4
+-0x1.0526eap+1
+-0x1.920afp+1
+0x1.3b665cp+0
+-0x1.519b7ep+1
+-0x1.8f3cecp+0
+0x1.457882p+1
+-0x1.3258ep+1
+0x1.0f97p-3
+-0x1.b72fb4p+0
+-0x1.2e5c8p-4
+-0x1.70e9b2p+1
+-0x1.74f81ap+1
+-0x1.7334fp+0
+0x1.e1fef4p+0
+0x1.04971ap+1
+-0x1.817562p+0
+0x1.3574bep+1
+-0x1.5081ep-2
+-0x1.a0a72p-3
+-0x1.3a18bp+0
+0x1.fa322p-3
+0x1.de3e38p-1
+-0x1.65836ap+1
+-0x1.7f7cbp+0
+-0x1.9724p-4
+0x1.7067a8p-1
+-0x1.d0090ep+0
+0x1.13f12ap+1
+-0x1.52518p+1
+-0x1.5503d8p-1
+0x1.35548ap+1
+0x1.0023f2p+1
+-0x1.746eep+0
+0x1.86d79ap+1
+-0x1.a550ap+0
+-0x1.baf11p+0
+-0x1.92dec2p+0
+0x1.6b95eap+1
+0x1.b102cp-1
+0x1.855724p+0
+0x1.1b0b74p+0
+-0x1.8e5a96p+1
+0x1.ca8214p+0
+-0x1.38ed78p-1
+0x1.95a468p-1
+0x1.9c746cp+0
+-0x1.e85314p+0
+-0x1.6b2b12p+1
+-0x1.4cb7eap+1
+-0x1.fe757p-2
+-0x1.5ba572p+1
+-0x1.f129cp-3
+-0x1.1a0e3cp+1
+-0x1.100f58p+1
+-0x1.6b0568p+1
+-0x1.10a6p+1
+0x1.934a6cp+0
+-0x1.78d54p-2
+-0x1.2b10dcp+1
+0x1.28bdecp+0
+-0x1.2df69p+1
+-0x1.23651ap+1
+0x1.8a48d6p+1
+-0x1.05b164p+1
+0x1.3c3e94p+0
+0x1.45917ep+1
+-0x1.1284d2p+1
+0x1.06aeb4p+0
+-0x1.a10572p+0
+-0x1.4ae1fcp+1
+0x1.c50ee4p+0
+-0x1.141c5p-2
+-0x1.a67c96p+0
+0x1.8337dep+1
+0x1.0f228p-5
+-0x1.777c5ep+1
+0x1.1c2f34p+0
+0x1.4bc24ep+1
+0x1.7e5b4p-3
+0x1.420edep+1
+0x1.e577ecp+0
+-0x1.3b25f4p+1
+0x1.3c935p-1
+-0x1.b5762p-2
+0x1.96f8b4p+0
+0x1.436c12p+1
+-0x1.335d86p+0
+0x1.2b64b2p+1
+-0x1.11ee7cp+1
+0x1.5e842ap+1
+0x1.7c93cp-4
+-0x1.72fddcp+1
+0x1.313e58p-1
+-0x1.b369a8p+0
+0x1.508c26p+1
+0x1.386508p-1
+0x1.1e117p-1
+-0x1.6baaa6p+1
+0x1.14d62cp+0
+-0x1.242b26p+1
+0x1.040b0ep+1
+0x1.085f46p+1
+-0x1.4bbbf4p+0
+-0x1.9ad088p+0
+0x1.6360b6p+1
+-0x1.39a1f4p+1
+-0x1.7029ccp+0
+0x1.43df58p-1
+0x1.60146p-2
+-0x1.d05486p+0
+0x1.a6d4d4p+0
+0x1.83b4d8p-1
+-0x1.688454p+1
+-0x1.4c07p-5
+-0x1.4e7edcp+1
+-0x1.5dca0cp+0
+0x1.1f5afp-1
+0x1.b67434p+0
+0x1.20a152p+1
+-0x1.af6b14p+0
+0x1.f5a9c8p-1
+-0x1.15d9f8p-1
+0x1.3177aep+1
+-0x1.45082p+1
+-0x1.657888p+1
+-0x1.194678p+1
+-0x1.95858p-3
+0x1.140e86p+1
+-0x1.3d54cp-3
+-0x1.79e0e2p+1
+0x1.1b11ccp+0
+-0x1.7d0454p+0
+-0x1.4ac6e8p+0
+-0x1.9871a8p+0
+0x1.55296cp+0
+-0x1.7c9e92p+0
+-0x1.507ddp-2
+0x1.c0498p-5
+0x1.3018fep+1
+-0x1.a50ccp-3
+0x1.8df8p-2
+-0x1.4eff4ep+1
+0x1.de3ab4p+0
+-0x1.966eap-3
+0x1.f052d8p-1
+0x1.c5fd4p-4
+0x1.82b0a2p+1
+-0x1.bf424p-3
+-0x1.1186bcp+0
+-0x1.30681p-2
+-0x1.1e3544p+0
+0x1.63830ap+1
+0x1.4b5706p+1
+0x1.b60cdcp+0
+0x1.c2b458p-1
+-0x1.fffae8p+0
+0x1.2ca696p+1
+-0x1.9bfc9p-2
+-0x1.43a43ep+0
+0x1.e7ed44p+0
+0x1.dc92b4p+0
+-0x1.1074a8p+1
+0x1.c07684p+0
+-0x1.76a65p-2
+0x1.0a2f8ap+1
+-0x1.edc174p+0
+-0x1.4336cap+0
+-0x1.70e4fep+0
+0x1.72407ap+1
+0x1.66a856p+1
+0x1.e2bee8p-1
+0x1.fd7c7p-2
+-0x1.5d569p-1
+-0x1.3e27bp-1
+-0x1.27e5cap+0
+0x1.3cdf6cp+0
+-0x1.8916cp-3
+-0x1.4ff0ecp+1
+-0x1.5705b8p+1
+-0x1.486b6cp+1
+-0x1.88c5bcp+0
+-0x1.df13p-3
+0x1.bb22bcp+0
+0x1.c0934cp+0
+0x1.7925bp-1
+0x1.366e5ap+1
+0x1.03ec8ep+1
+-0x1.040edcp+0
+-0x1.011478p+1
+-0x1.43c18p+1
+0x1.5ea5c4p+0
+-0x1.86ec4p-1
+-0x1.1e18a2p+1
+0x1.6453dcp+0
+0x1.6fbe7cp+0
+-0x1.82ac76p+1
+0x1.2dc6bep+1
+0x1.70b4cep+1
+0x1.d488e8p-1
+-0x1.0a018cp+0
+-0x1.791f68p+1
+-0x1.88882p-3
+0x1.f1ff0cp+0
+-0x1.88bba2p+1
+-0x1.926158p+0
+-0x1.58d7acp+1
+-0x1.65f67p+1
+0x1.2ae45ap+1
+0x1.24eb9cp+0
+-0x1.ebd08ep+0
+0x1.0242b8p-1
+0x1.b0349cp+0
+0x1.c1a42p-2
+-0x1.5f4784p+1
+0x1.e9448p-3
+0x1.f348ep-3
+0x1.877848p-1
+0x1.56816cp+0
+-0x1.39c0bep+0
+-0x1.2a8fdp+1
+-0x1.c3e7b4p+0
+0x1.25662p-1
+-0x1.ea7598p-1
+-0x1.31269ap+1
+0x1.283dep-3
+-0x1.e2b0cp-2
+0x1.5121c8p-1
+0x1.07a8d6p+1
+-0x1.3ead18p-1
+0x1.2af13p-1
+-0x1.35b524p+0
+-0x1.47ff4p-1
+0x1.3f13c6p+1
+0x1.a2bp-5
+-0x1.cd0156p+0
+0x1.018a8p-5
+0x1.2f6bbp-1
+0x1.49587cp+0
+0x1.df4984p+0
+0x1.0cd6ep-3
+0x1.af51fp-1
+0x1.497f8ap+1
+-0x1.5c0eacp+0
+0x1.2a8494p+0
+0x1.2581f4p+0
+-0x1.113328p+0
+0x1.24a4f2p+1
+-0x1.322752p+1
+0x1.ac459p-2
+-0x1.a04c9p+0
+0x1.b1f848p-1
+0x1.972afcp+0
+0x1.6d286ap+1
+-0x1.b0b58p-5
+-0x1.d45bbp+0
+0x1.198984p+0
+-0x1.8f2c7p+0
+0x1.f1df6p-2
+-0x1.65d894p+1
+-0x1.32006p+0
+-0x1.2f1f82p+1
+0x1.3ff68ep+1
+-0x1.8102e4p+1
+0x1.7249bp-1
+-0x1.6a6cp+1
+0x1.287eccp+0
+0x1.339abp-2
+-0x1.794098p+1
+0x1.a37a5cp+0
+0x1.04fc8p-1
+-0x1.8a59dp+1
+-0x1.874d7p-2
+-0x1.10df74p+0
+-0x1.610798p+0
+0x1.71e7ccp+0
+0x1.4d47e8p-1
+0x1.4edafcp+0
+-0x1.a57118p-1
+0x1.41303cp+0
+0x1.98a3ap-2
+0x1.6f7c3ap+1
+-0x1.291d46p+1
+-0x1.a9c76p-3
+-0x1.72adap-1
+0x1.4aa19ap+1
+0x1.741e8ep+1
+0x1.7ba3a2p+1
+-0x1.31183ep+1
+0x1.3a5e8cp+0
+-0x1.2ebaecp+0
+-0x1.3a7cd2p+0
+-0x1.33916p-2
+-0x1.5e834ep+1
+0x1.61102p-2
+0x1.c0ffdcp+0
+-0x1.6b72fep+1
+-0x1.c995cp+0
+-0x1.9dd654p+0
+-0x1.c6d9d8p-1
+-0x1.154cfep+1
+0x1.5bc8cp-3
+0x1.8a66ecp+0
+0x1.a0974p-2
+0x1.6fca2cp+0
+-0x1.71c6p-6
+-0x1.2a8c98p+1
+-0x1.d5744p-4
+0x1.51e50ap+1
+0x1.945c84p+0
+0x1.a0c678p-1
+0x1.527ddep+1
+-0x1.b588cp+0
+0x1.946c74p+0
+-0x1.623712p+0
+-0x1.f7cc88p-1
+-0x1.c6787p-2
+-0x1.1ecf7cp+0
+0x1.da3218p-1
+0x1.4a276ep+1
+0x1.8a3782p+1
+0x1.a25d6cp+0
+0x1.6b082ep+1
+-0x1.5d4a42p+1
+-0x1.39d75ep+1
+0x1.4aa4aep+1
+-0x1.cb94cp+0
+-0x1.6f71ap-1
+0x1.f18f9cp+0
+-0x1.e1782p-3
+0x1.da34d8p-1
+0x1.772bd6p+1
+0x1.8f98e4p+0
+0x1.18f91ep+1
+-0x1.c6fbfcp+0
+-0x1.0b16ep-1
+-0x1.3cfa34p+1
+-0x1.94a51p-1
+-0x1.233dap-2
+0x1.57b1ecp+0
+0x1.76a8a4p+0
+-0x1.72d9f4p+0
+0x1.5649p-4
+-0x1.797adp+1
+-0x1.8b8eeap+1
+-0x1.d7543ap+0
+0x1.ab99cp-1
+-0x1.23328p-3
+-0x1.0eca8cp+1
+0x1.9505dp-2
+0x1.0c154p-4
+0x1.d806p-2
+0x1.93966p-3
+0x1.a37828p-1
+0x1.8e30f6p+1
+0x1.fcad14p+0
+0x1.4aa54p-1
+0x1.61c482p+1
+-0x1.f180ep-3
+0x1.495f5cp+0
+-0x1.530be8p+1
+-0x1.035878p+1
+0x1.9367b4p+0
+0x1.b94a48p-1
+0x1.902a8ap+1
+-0x1.4b535ep+1
+0x1.525e6p-3
+-0x1.53318p-2
+-0x1.3dfd6p-2
+0x1.10d866p+1
+-0x1.b71598p-1
+0x1.59e52p-3
+-0x1.64f632p+0
+0x1.d18d48p-1
+0x1.94e764p+0
+-0x1.44e1aep+0
+0x1.17130ep+1
+0x1.fcb98p-3
+0x1.6b4306p+1
+0x1.28bce2p+1
+0x1.095224p+0
+0x1.f27bc4p+0
+-0x1.40d1b2p+1
+-0x1.4a0a04p+1
+-0x1.1bbdc8p-1
+-0x1.3b630cp+1
+0x1.65cfe8p-1
+0x1.29d952p+1
+0x1.3571aap+1
+-0x1.e92e2p+0
+-0x1.3b776cp+1
+0x1.6834c6p+1
+-0x1.87ea66p+1
+-0x1.11651cp+0
+0x1.052172p+1
+0x1.5b885p-2
+-0x1.0c89cp+0
+0x1.d8064p-2
+0x1.a739ep-3
+-0x1.617332p+0
+-0x1.045698p+0
+-0x1.8d4482p+0
+-0x1.87958p-5
+0x1.b87488p-1
+0x1.b26a78p-1
+-0x1.4f0ebp+1
+0x1.0944fp-2
+-0x1.71057p-2
+0x1.b1acp-3
+0x1.547e06p+1
+-0x1.75533ep+1
+0x1.0912d6p+1
+0x1.6af7eep+1
+0x1.802384p+0
+-0x1.19f58p+0
+-0x1.00b69cp+0
+-0x1.29ec6p+1
+0x1.89394p-2
+0x1.2e24bcp+0
+0x1.a4c0ep-2
+0x1.48b118p-1
+0x1.77005cp+0
+0x1.191ec6p+1
+-0x1.50bec8p+0
+0x1.358036p+1
+-0x1.77dedp-1
+0x1.ca237cp+0
+0x1.0eb1cp-2
+0x1.6da17p-1
+0x1.5f0cf4p+0
+0x1.21f4e8p-1
+-0x1.b7593p-1
+-0x1.1bbe7cp+1
+0x1.2e698ep+1
+-0x1.93470ap+0
+0x1.3b23bcp+0
+-0x1.c2403p-1
+-0x1.f45ecp+0
+-0x1.fa3b96p+0
+0x1.57af32p+1
+0x1.879dccp+0
+-0x1.0ba27p-2
+-0x1.84b3bp-1
+0x1.8d7a44p+0
+0x1.445e7cp+0
+0x1.df92e4p+0
+0x1.aaff4p-4
+-0x1.d81d8p-1
+0x1.710c5ep+1
+0x1.d9e0c4p+0
+-0x1.914702p+1
+0x1.31f984p+0
+0x1.3af1d8p-1
+0x1.4afcc6p+1
+-0x1.32edc8p-1
+0x1.770e36p+1
+-0x1.0f3624p+0
+0x1.c13508p-1
+-0x1.c6aa88p-1
+-0x1.30fbfcp+1
+-0x1.90ce32p+1
+0x1.4d712p-2
+0x1.3ecc8p-3
+0x1.36e5f2p+1
+0x1.14bab8p-1
+-0x1.84c1dep+0
+-0x1.0d9378p-1
+-0x1.3645ccp+1
+-0x1.438ecp-4
+-0x1.e52dd2p+0
+0x1.4e64a6p+1
+0x1.f3086p-2
+-0x1.4d4ebcp+1
+-0x1.3a744p+1
+-0x1.3de19ap+1
+-0x1.8bb34p-4
+-0x1.4d6e0ap+1
+0x1.5707cp-2
+0x1.cc759p-2
+-0x1.1de1fp+0
+-0x1.f7824p-1
+0x1.65a74ep+1
+0x1.0e9914p+0
+0x1.69d20ep+1
+0x1.909af4p+0
+-0x1.796e08p-1
+0x1.bb2728p-1
+0x1.71ede4p+0
+0x1.1b3c1ap+1
+-0x1.030d4p-3
+-0x1.19c81ap+1
+0x1.36dc22p+1
+0x1.c8650cp+0
+-0x1.2218a8p+0
+-0x1.2a2d16p+0
+0x1.39001ep+1
+0x1.cd34p-4
+0x1.351c7cp+0
+-0x1.9b35cp-1
+-0x1.151d6ap+1
+-0x1.1e4cdp-1
+0x1.826f0cp+0
+-0x1.36c9a6p+0
+-0x1.37c9a2p+1
+0x1.079e9ep+1
+0x1.aa597p-2
+-0x1.c3692ep+0
+0x1.9ae334p+0
+0x1.017542p+1
+0x1.e86624p+0
+0x1.71bf5cp+0
+0x1.6b9d96p+1
+-0x1.7f1ee8p+0
+-0x1.2e81a6p+0
+0x1.c91e08p-1
+0x1.296d54p+0
+-0x1.5b11b4p+0
+-0x1.89600ap+1
+0x1.08576ep+1
+0x1.ee7158p-1
+0x1.31150cp+0
+-0x1.6f0a86p+0
+-0x1.17691cp+0
+0x1.787f52p+1
+-0x1.eee68p-3
+-0x1.3dc776p+1
+0x1.7c34bp-1
+0x1.257b7ap+1
+0x1.a6be5p-1
+-0x1.40a1p+1
+-0x1.5e561ap+1
+-0x1.99dd3ep+0
+0x1.2ae01ep+1
+-0x1.071be8p+0
+-0x1.3f0152p+0
+-0x1.940c24p+0
+0x1.e5d878p-1
+0x1.b85e1cp+0
+0x1.1d715ep+1
+0x1.9017b8p-1
+0x1.a73ab4p+0
+0x1.c0599cp+0
+-0x1.7e27b4p+0
+-0x1.3c4bd8p-1
+-0x1.7c625cp+1
+-0x1.3085c6p+0
+0x1.e6c01p-2
+-0x1.91a7cp+1
+0x1.d6dd9cp+0
+0x1.4cf9ep-3
+-0x1.3580b8p-1
+0x1.e6e68p-4
+-0x1.5adcp-3
+-0x1.dcf74p-3
+0x1.75174p-3
+0x1.df84fcp+0
+0x1.68b5e2p+1
+0x1.4a679p-2
+0x1.249bbp-1
+-0x1.c89906p+0
+0x1.77791p-2
+-0x1.239454p+0
+0x1.fe8454p+0
+0x1.0f3362p+1
+0x1.8ea5bap+1
+-0x1.e9a178p-1
+-0x1.4454p-2
+-0x1.5d47bap+0
+0x1.482d42p+1
+0x1.10bffcp+0
+-0x1.9fa6p-2
+0x1.77bb2cp+0
+-0x1.3a35ep-3
+-0x1.3cda5p+1
+0x1.801aeap+1
+-0x1.50c56p-2
+0x1.c1306cp+0
+-0x1.79e8cep+1
+-0x1.7af01cp+1
+0x1.c1d8p-3
+-0x1.6d3bccp+1
+0x1.560e6ep+1
+0x1.65184cp+0
+0x1.8da344p+0
+-0x1.90bcf8p-1
+0x1.24db12p+1
+0x1.e3fdap-3
+0x1.d6fd38p-1
+-0x1.12986cp+1
+-0x1.5f6556p+1
+-0x1.3ea288p+1
+0x1.7a442cp+0
+0x1.7616dap+1
+-0x1.22da7p+1
+-0x1.329898p+0
+0x1.49adf6p+1
+-0x1.573ffcp+1
+-0x1.098c1cp+0
+0x1.04d5fep+1
+-0x1.577a2p-1
+-0x1.8022cap+1
+0x1.48f4a6p+1
+0x1.66c4bap+1
+0x1.7865eep+1
+-0x1.652938p-1
+0x1.8d898p-3
+0x1.6eb1d4p+0
+-0x1.66783ap+1
+-0x1.667b3p+0
+0x1.ae5054p+0
+0x1.e7b8acp+0
+0x1.de0858p-1
+0x1.6ec0d6p+1
+0x1.0be6c6p+1
+-0x1.6b1a7p+1
+-0x1.6864ep-2
+-0x1.59d4p+1
+-0x1.172afp-2
+-0x1.8f785ap+0
+-0x1.13c2cp-3
+-0x1.18a2e8p+0
+-0x1.111274p+1
+0x1.3ef99ep+1
+-0x1.95434p-1
+-0x1.b85492p+0
+0x1.bc6aep-3
+0x1.712f96p+1
+0x1.0fb5c4p+0
+0x1.bcc17p-2
+-0x1.405382p+0
+-0x1.5f9dp-2
+-0x1.8c5d58p+1
+-0x1.d14c7p-1
+0x1.cfda5p-2
+-0x1.f6f7ep+0
+-0x1.73d96cp+1
+0x1.14111cp+0
+-0x1.46b74ap+1
+0x1.204752p+1
+0x1.35815ep+1
+-0x1.19fap-3
+-0x1.d7d764p+0
+-0x1.636fc2p+0
+0x1.04eaf8p-1
+0x1.e93578p-1
+-0x1.ef152p-1
+0x1.780c9ap+1
+-0x1.43d5cap+1
+-0x1.6028e6p+1
+-0x1.21ff5ep+1
+-0x1.ee6b6ep+0
+-0x1.be7708p-1
+0x1.7811a6p+1
+0x1.0bc34p-4
+-0x1.b71808p-1
+-0x1.26842p-3
+0x1.08d31ep+1
+0x1.92e25cp+0
+-0x1.e9b934p+0
+-0x1.baec5p-2
+-0x1.7446cp-4
+-0x1.78f7c8p-1
+-0x1.6926e4p+1
+-0x1.bd5cd4p+0
+0x1.6c2edap+1
+-0x1.3174e4p+1
+-0x1.27a778p+1
+0x1.82d6a2p+1
+0x1.b3e42p-2
+-0x1.1d41fp+1
+-0x1.95d454p+0
+-0x1.78dc7ep+1
+0x1.5b6e86p+1
+-0x1.6548a8p+1
+-0x1.638238p+1
+-0x1.15d018p+1
+0x1.056482p+1
+-0x1.7bf5b8p+1
+-0x1.0225ep+1
+0x1.c061b4p+0
+0x1.2b07c8p-1
+0x1.b01494p+0
+-0x1.7e7c84p+0
+0x1.622696p+1
+-0x1.a69c6p-3
+0x1.2622ep-3
+0x1.19946cp+0
+0x1.3f02b4p+0
+0x1.efbb14p+0
+-0x1.0378fp+0
+-0x1.420b52p+0
+-0x1.35418p-5
+0x1.f3d44p-4
+0x1.4f1372p+1
+0x1.173c56p+1
+0x1.493182p+1
+0x1.4cfe7ep+1
+-0x1.fe7088p-1
+0x1.79eb34p+0
+-0x1.0b5b44p+0
+0x1.51cf8ap+1
+0x1.8edcaep+1
+0x1.0d97dep+1
+-0x1.38f58p-1
+-0x1.e866cp-3
+0x1.2aaed8p-1
+0x1.6c869ap+1
+-0x1.5d020ep+0
+0x1.95b81cp+0
+0x1.fe2574p+0
+0x1.76682ep+1
+0x1.bf3764p+0
+-0x1.09f2fp-1
+-0x1.5eb574p+1
+-0x1.ee76ep-3
+0x1.188b8cp+0
+0x1.368646p+1
+0x1.bb03e4p+0
+0x1.e4174p-4
+0x1.be4c58p-1
+-0x1.0f983p+1
+0x1.bbf16cp+0
+-0x1.cabf64p+0
+-0x1.462554p+1
+0x1.b746fcp+0
+-0x1.e925ap-3
+0x1.7fa2b8p-1
+0x1.c8b8c4p+0
+0x1.7c7bd4p+0
+-0x1.25f93p+1
+-0x1.3d33eep+1
+0x1.041eecp+0
+-0x1.43feep-3
+-0x1.18d138p+0
+-0x1.716852p+0
+0x1.41bccp-1
+-0x1.4361b8p-1
+-0x1.8b045cp+1
+0x1.be08p-4
+0x1.c6ef4cp+0
+-0x1.5e038p+1
+0x1.886ea2p+1
+-0x1.d237ap-3
+0x1.b659ep-2
+0x1.c8613p-2
+0x1.0a5b14p+0
+0x1.8fb698p-1
+0x1.c35b54p+0
+0x1.1f31d4p+0
+-0x1.abbc4p-1
+0x1.00ed26p+1
+0x1.35c6c4p+0
+-0x1.1f7be8p+0
+0x1.6152ep-1
+-0x1.f98fap-2
+0x1.22cd12p+1
+0x1.3e8bbp-1
+0x1.6ac6e4p+0
+-0x1.328444p+1
+0x1.8177dap+1
+0x1.5bd086p+1
+-0x1.65a6aep+1
+-0x1.79374p-1
+0x1.9b5614p+0
+0x1.b0c08p-5
+0x1.eb9c04p+0
+-0x1.697ce8p+0
+-0x1.deb39p-1
+0x1.3dea5p-2
+0x1.76ce3ap+1
+-0x1.3b611ep+1
+0x1.af92ccp+0
+0x1.76357ap+1
+0x1.bfc0c8p-1
+0x1.a682f4p+0
+-0x1.6385e2p+0
+0x1.1dd7d4p+0
+-0x1.99de6cp+0
+0x1.0462b6p+1
+0x1.8454eep+1
+0x1.ba8b74p+0
+0x1.4c256p-1
+0x1.c15cbcp+0
+0x1.101e5ep+1
+-0x1.03b2ecp+1
+-0x1.ad10f8p-1
+0x1.26085ap+1
+-0x1.28387p+1
+-0x1.1bbaep+1
+-0x1.08f2acp+1
+0x1.17c7f4p+0
+0x1.437c9ap+1
+0x1.fb7ed8p-1
+0x1.34c042p+1
+0x1.58a004p+0
+-0x1.38419p-2
+0x1.fe0864p+0
+0x1.c02f8cp+0
+0x1.29f6bp-2
+0x1.17b72ep+1
+0x1.5f504ep+1
+-0x1.0233d8p+1
+0x1.bbda28p-1
+-0x1.7bff38p-1
+-0x1.b94a6p+0
+0x1.59b8p-7
+0x1.658db4p+0
+0x1.ec136p-3
+-0x1.d9afd4p+0
+0x1.8f10e2p+1
+-0x1.45388cp+1
+-0x1.3fda02p+1
+-0x1.336fb2p+0
+-0x1.291f08p+1
+-0x1.1c5cf8p+0
+-0x1.c344c4p+0
+-0x1.9f5644p+0
+0x1.2dc94cp+0
+0x1.0ba69ep+1
+0x1.f44894p+0
+0x1.49225ap+1
+0x1.1c438cp+0
+0x1.8725acp+0
+0x1.67e0ep-2
+0x1.097e1p-1
+0x1.47474p-2
+-0x1.e643ap-2
+-0x1.72a6aap+0
+0x1.5669a8p-1
+-0x1.09813p-1
+-0x1.72b2ap-1
+0x1.f0b744p+0
+0x1.a97dbp-1
+-0x1.22536p-2
+-0x1.3ddc94p+1
+0x1.3d956ap+1
+-0x1.47b386p+0
+-0x1.7430b8p-1
+-0x1.88e3aep+1
+0x1.82b96ep+1
+-0x1.fc3bbcp+0
+-0x1.7f3be8p+1
+0x1.9ce1f4p+0
+0x1.0d6464p+0
+-0x1.e06bf8p-1
+0x1.8c315p-2
+-0x1.68724p-2
+0x1.5c955ap+1
+-0x1.2fd6c2p+1
+0x1.60e2c6p+1
+-0x1.76f752p+1
+0x1.df264p-3
+-0x1.1d3fap+0
+0x1.786faap+1
+-0x1.fb2274p+0
+0x1.9831p-6
+-0x1.1eb656p+1
+0x1.17b62ap+1
+0x1.1c1576p+1
+-0x1.bc353ep+0
+-0x1.840792p+1
+0x1.0031fp-2
+0x1.80169cp+0
+0x1.e0501cp+0
+-0x1.a43a5p+0
+0x1.0ede78p-1
+0x1.c44df8p-1
+0x1.0a36cp-2
+0x1.49afb6p+1
+-0x1.c8c4e2p+0
+0x1.af15dcp+0
+0x1.263b66p+1
+-0x1.4285e2p+0
+-0x1.ac28p-5
+0x1.3a0044p+0
+-0x1.d8574p-3
+0x1.c3dd1p-2
+0x1.28d656p+1
+0x1.8488dcp+0
+-0x1.863e6ap+0
+0x1.348d6ep+1
+0x1.9a0ffp-2
+0x1.17d4bcp+0
+-0x1.e5299p-2
+-0x1.1b8ee4p+1
+0x1.a406e4p+0
+-0x1.25dbd8p+0
+-0x1.9189acp+1
+-0x1.95603p+0
+0x1.b4c7c4p+0
+-0x1.9c4b88p-1
+-0x1.5ddf4p-4
+-0x1.86bbe2p+1
+-0x1.7ded24p+1
+-0x1.4ec9dp+1
+-0x1.0e4ddcp+1
+0x1.83eaa4p+0
+0x1.e02704p+0
+0x1.8cf16p-2
+-0x1.353718p-1
+-0x1.8146c6p+1
+-0x1.56c3b2p+1
+-0x1.ef0d4p-4
+-0x1.dca86p+0
+0x1.6cc4fep+1
+-0x1.8d0448p-1
+-0x1.365afep+0
+0x1.9d8e68p-1
+-0x1.3f3ff4p+1
+0x1.350906p+1
+0x1.ef3538p-1
+0x1.2e8e54p+0
+0x1.2df8c2p+1
+-0x1.71816ap+1
+0x1.e6d798p-1
+0x1.82d70ap+1
+0x1.4682ap-1
+-0x1.07629p+0
+-0x1.084a4p-1
+0x1.733584p+0
+-0x1.bb6c94p+0
+-0x1.d60ed4p+0
+0x1.4d3cb2p+1
+-0x1.03d87p-1
+0x1.6acf4ep+1
+-0x1.ed51cp-2
+0x1.116d16p+1
+0x1.bba4p-7
+0x1.5aac24p+0
+0x1.144f9ep+1
+0x1.d07fecp+0
+-0x1.8c0646p+1
+-0x1.d83a6p-3
+0x1.5dbf14p+0
+0x1.74a4b2p+1
+0x1.53702ep+1
+-0x1.8bead8p+1
+0x1.45ea9cp+0
+0x1.77a3bap+1
+0x1.d1446p-3
+-0x1.f0f076p+0
+-0x1.772a02p+1
+-0x1.424f6p-1
+0x1.5b0fbp-1
+0x1.46f5dcp+0
+0x1.2dbb7ap+1
+-0x1.73433cp+1
+0x1.5b382ap+1
+0x1.797cc8p-1
+0x1.061164p+0
+0x1.019956p+1
+0x1.90085cp+0
+-0x1.4325a8p-1
+-0x1.aa79a2p+0
+-0x1.37501ep+0
+0x1.8ce18p-1
+0x1.852ef6p+1
+0x1.dc0f8p-2
+-0x1.540c4ap+1
+-0x1.94b4d6p+0
+0x1.aaef04p+0
+-0x1.76494p-4
+-0x1.597114p+1
+0x1.9606p-3
+0x1.f50484p+0
+0x1.05dfap-1
+0x1.d02fb8p-1
+0x1.7bef2p-1
+-0x1.5da2ap-2
+-0x1.05f2bp+1
+-0x1.b10bc8p-1
+-0x1.56ff0cp+1
+0x1.b5af1p-1
+-0x1.14beecp+1
+-0x1.2decc4p+1
+0x1.5fb776p+1
+0x1.43e368p-1
+0x1.b95bd8p-1
+-0x1.cd8438p-1
+-0x1.0e9d5cp+0
+0x1.2e1516p+1
+-0x1.d94718p-1
+0x1.360052p+1
+0x1.11a626p+1
+-0x1.124f84p+1
+-0x1.862e8p+1
+0x1.aab9dp-2
+-0x1.dc7a2p+0
+0x1.12a9f6p+1
+-0x1.a6336p-1
+0x1.793ddcp+0
+-0x1.84682ep+0
+-0x1.549aa4p+1
+0x1.9ae8cp-1
+-0x1.6bec64p+0
+0x1.43cd12p+1
+-0x1.b78692p+0
+0x1.63e90ep+1
+-0x1.a09dfap+0
+-0x1.2ea4e8p+0
+-0x1.dde0d2p+0
+-0x1.e0dcb8p+0
+-0x1.80cf28p+1
+0x1.0fee66p+1
+-0x1.7fcbf4p+0
+-0x1.93db0ap+0
+0x1.f341a8p-1
+0x1.10a932p+1
+0x1.070ecp-4
+-0x1.4f5e78p+0
+-0x1.7ac8a6p+0
+0x1.9c77p-1
+-0x1.3f7a98p-1
+-0x1.434628p-1
+0x1.cb023p-2
+0x1.a5ca2p-3
+-0x1.345578p-1
+0x1.947528p-1
+0x1.b2f64p-2
+0x1.5da2bcp+0
+0x1.ebedd4p+0
+0x1.711458p-1
+0x1.7be0d4p+0
+0x1.ed6c4cp+0
+-0x1.b9a7bap+0
+0x1.33f5b4p+0
+-0x1.026394p+0
+0x1.847d38p-1
+-0x1.20faccp+1
+-0x1.d8adap-3
+-0x1.29f6c2p+1
+0x1.56de4cp+0
+-0x1.4600dap+1
+0x1.93fc24p+0
+0x1.399ffcp+0
+0x1.b5f08p-3
+-0x1.f9fep-7
+-0x1.eb245ep+0
+0x1.5c23a8p-1
+-0x1.09c3dcp+0
+0x1.36e5p-2
+0x1.954ac8p-1
+0x1.57bdf2p+1
+0x1.67626ap+1
+0x1.11a44ep+1
+-0x1.8aca62p+1
+-0x1.920cbap+0
+0x1.3fca2p-3
+-0x1.0012a4p+1
+-0x1.1e73e8p+1
+-0x1.70634cp+0
+-0x1.8c7166p+0
+-0x1.3a79a6p+1
+0x1.07c6bcp+0
+0x1.131184p+0
+0x1.022344p+0
+0x1.984b3cp+0
+0x1.605a54p+0
+-0x1.e6226ep+0
+0x1.5b4d06p+1
+-0x1.20cfe8p+0
+0x1.760b5cp+0
+0x1.198a3ap+1
+-0x1.5fcfd2p+1
+-0x1.1ecb28p-1
+-0x1.0f8c78p+1
+0x1.75df54p+0
+-0x1.674788p+1
+-0x1.d56cp-1
+-0x1.7a2e66p+1
+-0x1.e9b94p-1
+0x1.759a3ap+1
+0x1.76432ep+1
+0x1.9d626cp+0
+0x1.4a044ap+1
+-0x1.315a56p+1
+-0x1.418988p+0
+0x1.d4b85cp+0
+-0x1.3bb148p+1
+-0x1.bb8a84p+0
+0x1.86e6b6p+1
+-0x1.751f2p-3
+-0x1.1024e4p+1
+-0x1.527868p+0
+0x1.20effep+1
+0x1.efc8a8p-1
+0x1.3bf4dcp+0
+0x1.3efcd6p+1
+0x1.b7d728p-1
+-0x1.eb462p-2
+-0x1.fe3e94p+0
+-0x1.8a95e8p+1
+0x1.b5acep-3
+-0x1.16ef0cp+1
+-0x1.404778p-1
+-0x1.c4e49p+0
+-0x1.7170b8p+0
+-0x1.86b118p+0
+-0x1.de0046p+0
+0x1.4f9286p+1
+-0x1.c1a744p+0
+-0x1.325812p+1
+0x1.17e41p-1
+0x1.ba8d74p+0
+0x1.29acccp+0
+0x1.2deb3ap+1
+0x1.5ef732p+1
+0x1.462dc6p+1
+0x1.4e062ap+1
+0x1.257f36p+1
+0x1.5ebb16p+1
+0x1.9149c2p+1
+0x1.c4d5cp-3
+0x1.6cb48ap+1
+-0x1.77a19cp+1
+0x1.b72568p-1
+0x1.db8474p+0
+-0x1.28b096p+1
+-0x1.0252ep+0
+-0x1.3d058ap+0
+0x1.7d73f6p+1
+-0x1.7f818p+1
+-0x1.55cbfp+1
+0x1.4aaa14p+0
+0x1.f187cp-2
+-0x1.118508p+1
+0x1.192e7p-2
+-0x1.8b12e6p+1
+-0x1.10e08cp+0
+-0x1.a9132p+0
+0x1.613b7ap+1
+-0x1.6af898p+0
+0x1.1c47e6p+1
+-0x1.fbfa58p-1
+0x1.35aa28p-1
+-0x1.15fd64p+0
+0x1.f95174p+0
+0x1.bba3p-4
+-0x1.c33beep+0
+0x1.495f78p-1
+-0x1.4fd6ecp+0
+-0x1.e8edd8p-1
+-0x1.34f2dp+1
+-0x1.11adbcp+1
+-0x1.c063cp+0
+-0x1.1b4ec4p+0
+-0x1.95b89p+0
+-0x1.0de23ep+1
+0x1.4f2e2p-3
+-0x1.5d9e32p+0
+-0x1.858be8p-1
+-0x1.09c948p+0
+-0x1.158768p+0
+0x1.a0eeep-1
+0x1.8a6dacp+0
+0x1.118d82p+1
+-0x1.1a7272p+1
+0x1.82bf26p+1
+0x1.e5b0a8p-1
+0x1.73ff82p+1
+-0x1.952bp-2
+-0x1.3969f4p+1
+0x1.1354eap+1
+-0x1.1be14cp+0
+-0x1.76ea94p+0
+-0x1.72bbd8p+1
+0x1.84fd4ep+1
+0x1.0e968p-3
+0x1.5059aap+1
+-0x1.31b5ep-3
+-0x1.d58272p+0
+0x1.cee4e8p-1
+0x1.268d92p+1
+-0x1.8cd0d2p+1
+0x1.592fdep+1
+-0x1.1dc498p+1
+0x1.05387p-1
+-0x1.aeab4ep+0
+-0x1.afe08p-4
+-0x1.005ap-2
+0x1.1b47bep+1
+-0x1.bab0cp-2
+-0x1.46940ap+1
+0x1.7b5fccp+0
+0x1.0d6dcp-2
+-0x1.34263ep+0
+0x1.20d1ecp+0
+-0x1.e10ecp-1
+-0x1.a2aaep+0
+0x1.37a32ap+1
+-0x1.7806eap+1
+-0x1.abfa8p-1
+0x1.394c1p-2
+0x1.433fb2p+1
+0x1.29be44p+0
+0x1.1ace58p-1
+-0x1.8e08d6p+1
+-0x1.0b07p-2
+0x1.75b8cep+1
+-0x1.efedcp-3
+0x1.a48f84p+0
+0x1.3cb19ep+1
+0x1.41f0b4p+0
+-0x1.04b098p-1
+0x1.fc366p-3
+-0x1.5e6ce2p+0
+0x1.640f96p+1
+-0x1.712d88p-1
+0x1.91c154p+0
+-0x1.4c5008p-1
+-0x1.e1e8bp-1
+0x1.d59004p+0
+0x1.49e3fap+1
+-0x1.b5708p-4
+0x1.079fd6p+1
+0x1.0a4314p+0
+0x1.d16148p-1
+0x1.1c2f5ep+1
+-0x1.03f06cp+0
+-0x1.eda33p-2
+-0x1.8b894ap+1
+0x1.0b0f5cp+0
+0x1.838da6p+1
+0x1.84498p-5
+-0x1.56f3d8p+0
+-0x1.7dcecap+1
+0x1.8ba17p-2
+0x1.7e481ap+1
+-0x1.fe6f4p-1
+0x1.a3f094p+0
+-0x1.2b6eb8p-1
+-0x1.29171cp+1
+0x1.7a1082p+1
+-0x1.ced826p+0
+-0x1.543a48p+0
+-0x1.378p-6
+0x1.cce638p-1
+-0x1.64198p-2
+-0x1.5525dap+0
+0x1.335bf6p+1
+0x1.9f04p-1
+0x1.6e83ecp+0
+-0x1.0191b8p+1
+0x1.2b653ep+1
+-0x1.dd712cp+0
+0x1.9f57b4p+0
+-0x1.9f1eb8p-1
+0x1.6e0274p+0
+0x1.3d869ap+1
+-0x1.4c2904p+1
+-0x1.4cec08p+1
+-0x1.0c59aap+1
+0x1.d5cc8p-2
+0x1.61ac14p+0
+0x1.843c22p+1
+0x1.952f94p+0
+-0x1.9c9b18p+0
+-0x1.ba2a66p+0
+-0x1.c85678p-1
+-0x1.69fb08p-1
+-0x1.ddap-1
+-0x1.067078p+1
+-0x1.431878p+1
+0x1.9fb18p-4
+0x1.7b0322p+1
+-0x1.83be94p+1
+-0x1.6fb8p-7
+-0x1.c84d4p-4
+0x1.dfb18p-5
+-0x1.270dacp+1
+0x1.cb3acp-3
+-0x1.3951p+0
+0x1.312c94p+0
+-0x1.add5e6p+0
+-0x1.ecd492p+0
+0x1.78156ep+1
+0x1.ff7b9cp+0
+0x1.59ec3ep+1
+0x1.198d2p-3
+-0x1.a53ccp+0
+-0x1.756fa6p+1
+0x1.0ec68p-4
+-0x1.0ed664p+0
+0x1.335dep-2
+-0x1.1ebebp-1
+-0x1.0cc96p-1
+-0x1.a4ff8p+0
+0x1.cae94p-3
+0x1.391072p+1
+0x1.1a35e6p+1
+-0x1.546d78p+1
+-0x1.297f2ep+0
+0x1.87dfaap+1
+0x1.d91424p+0
+0x1.e23b88p-1
+0x1.40b646p+1
+0x1.14b82cp+0
+0x1.4b9d82p+1
+0x1.4989p-3
+0x1.497ee6p+1
+-0x1.ae3c7ap+0
+-0x1.8c9196p+1
+-0x1.48fe58p+1
+-0x1.7ead0cp+0
+0x1.716de2p+1
+0x1.982c5cp+0
+-0x1.05cd9p-2
+0x1.695178p-1
+-0x1.f5e962p+0
+-0x1.5376cap+1
+-0x1.31c6fp-2
+0x1.847a6cp+0
+0x1.0cb004p+0
+0x1.88b58ep+1
+-0x1.8b3d0ep+0
+0x1.38e24cp+0
+0x1.d57b1cp+0
+-0x1.651618p+1
+-0x1.f980c8p+0
+0x1.4cbbbp-2
+0x1.1601b4p+0
+-0x1.b9402p-1
+-0x1.d2b83ep+0
+0x1.da559cp+0
+0x1.b2da8cp+0
+-0x1.a26cfap+0
+-0x1.14b7f8p-1
+0x1.df8f34p+0
+-0x1.af842p-1
+-0x1.5c4116p+1
+0x1.9bbb94p+0
+0x1.e813e8p-1
+-0x1.9673dp-2
+0x1.9a9374p+0
+0x1.a64e3p-2
+0x1.f5be78p-1
+0x1.0d8336p+1
+0x1.5b35dcp+0
+-0x1.c3f3cp-3
+-0x1.e2fd3ap+0
+0x1.ddd484p+0
+-0x1.475184p+0
+-0x1.752388p-1
+-0x1.653ed8p+1
+0x1.208daap+1
+0x1.993528p-1
+-0x1.752908p-1
+0x1.64cf86p+1
+-0x1.66d6c8p+1
+0x1.78a5bp-2
+-0x1.6de418p-1
+0x1.535286p+1
+0x1.19ef7p-1
+-0x1.19962p-2
+0x1.5cd492p+1
+-0x1.5be554p+0
+-0x1.9820d8p-1
+-0x1.8a22c4p+0
+-0x1.c7f1dcp+0
+-0x1.7df4dp-1
+0x1.89916ep+1
+-0x1.dd67cp+0
+-0x1.1f8b12p+1
+-0x1.d5d18p-4
+0x1.24d43cp+0
+-0x1.a1aa4cp+0
+-0x1.c2398p-1
+-0x1.192368p+0
+0x1.4e738ap+1
+0x1.d8ef0cp+0
+-0x1.2522e2p+1
+0x1.41315p-1
+0x1.5796ap-2
+-0x1.7ab7dp+1
+-0x1.29015ep+1
+0x1.8a2cd4p+0
+-0x1.ed34cp+0
+-0x1.70685ap+1
+0x1.3197e8p-1
+-0x1.64fef4p+1
+-0x1.565276p+1
+0x1.6943fcp+0
+-0x1.16a4ep+0
+0x1.807d2ap+1
+-0x1.95498p-3
+-0x1.1990f2p+1
+-0x1.653b88p-1
+-0x1.132602p+1
+0x1.18ad8p-5
+-0x1.1a46bp+1
+0x1.56417p-2
+0x1.3644ap-2
+0x1.89a0c6p+1
+-0x1.209c4p-2
+0x1.10a388p-1
+0x1.3754fep+1
+0x1.e3d9b8p-1
+-0x1.ddd158p-1
+-0x1.0c62ecp+1
+0x1.fe4b4cp+0
+0x1.08d28p-4
+-0x1.6afdep-2
+-0x1.5a727ep+0
+0x1.f1a38p-5
+0x1.8cc89ap+1
+-0x1.3f77b8p-1
+-0x1.0be18p-2
+0x1.7ad04cp+0
+0x1.29407cp+0
+-0x1.2d742p-2
+-0x1.75b16ep+1
+-0x1.20fa7p+1
+-0x1.6e6p-5
+0x1.285e0ep+1
+0x1.54c282p+1
+0x1.97beb8p-1
+0x1.85df5cp+0
+-0x1.a7c5a2p+0
+0x1.473d4p-2
+-0x1.1ee7dcp+0
+0x1.e9cf58p-1
+-0x1.64c64p-4
+0x1.5588p-5
+-0x1.822432p+1
+0x1.9133dep+1
+0x1.8f591cp+0
+-0x1.991092p+0
+-0x1.b91608p+0
+0x1.bd3108p-1
+-0x1.82183p-1
+-0x1.a341ep-1
+-0x1.378b5ep+1
+0x1.4a58cap+1
+-0x1.82e8e6p+1
+0x1.62caeap+1
+0x1.3228dep+1
+0x1.7ed79p-2
+0x1.bf304p-2
+0x1.f4a988p-1
+-0x1.fd96bap+0
+0x1.2207e2p+1
+0x1.32c7p-6
+0x1.14328p-1
+-0x1.1d4f2p-3
+0x1.1d3e4ep+1
+-0x1.1c78cp-2
+-0x1.4d403p-1
+-0x1.47172p-2
+-0x1.5c7b7ap+1
+0x1.89da26p+1
+-0x1.228afcp+1
+0x1.db7cf4p+0
+0x1.054f92p+1
+-0x1.24a954p+0
+0x1.27c9p-4
+0x1.0787d4p+0
+-0x1.3f0e1cp+1
+0x1.6ce7e6p+1
+-0x1.b891e2p+0
+-0x1.787d04p+1
+0x1.6b62fcp+0
+-0x1.2ef98p-4
+0x1.c3f4e8p-1
+0x1.66c41cp+0
+-0x1.d354b2p+0
+-0x1.246c7p-1
+0x1.8f512cp+0
+0x1.53cd9ep+1
+0x1.b52958p-1
+-0x1.d06aap-2
+-0x1.0138e4p+0
+0x1.f6133cp+0
+0x1.a53ffp-1
+-0x1.45db4ep+0
+0x1.fccf88p-1
+0x1.999f7cp+0
+0x1.57fb08p-1
+0x1.5c226p-1
+-0x1.32d118p+0
+0x1.4d4278p-1
+0x1.38245p-1
+-0x1.7309p+0
+0x1.2ad9p-1
+0x1.f99cecp+0
+0x1.36d748p-1
+-0x1.65ac4p-3
+-0x1.0287acp+0
+-0x1.1b0acep+1
+0x1.18341p-2
+-0x1.26c7p-2
+-0x1.3ac64p-3
+-0x1.a45d68p-1
+-0x1.188688p+0
+-0x1.23a75p+0
+-0x1.7011eep+1
+0x1.e2b628p-1
+-0x1.3fb42p-1
+-0x1.b9f5acp+0
+0x1.032c8p-4
+0x1.99928cp+0
+-0x1.52044cp+1
+0x1.3c525cp+0
+0x1.55874cp+0
+-0x1.44d48ep+1
+-0x1.7a3d9ep+0
+-0x1.3d5b2cp+0
+-0x1.09776p-3
+0x1.b4ca44p+0
+-0x1.5476p-3
+0x1.015436p+1
+-0x1.3d6ac8p+1
+-0x1.fcf6a8p+0
+-0x1.5514dp-1
+0x1.efcfcp-3
+-0x1.4cfea8p+1
+0x1.d41768p-1
+-0x1.834124p+1
+0x1.7eec7cp+0
+0x1.a3a3fp-1
+0x1.394e02p+1
+0x1.2df1bep+1
+-0x1.98b42p-3
+0x1.2d983cp+0
+0x1.09e25ep+1
+0x1.3c4f32p+1
+0x1.0bc9c4p+0
+0x1.1faf9p-1
+-0x1.6618p-8
+0x1.34f86ep+1
+-0x1.42828ep+0
+0x1.98617p-1
+-0x1.5f9cap+1
+0x1.21c6b8p-1
+-0x1.ffc0fp-2
+0x1.29f9b4p+0
+-0x1.878868p+1
+-0x1.12449cp+0
+0x1.45cf1cp+0
+0x1.14459ap+1
+0x1.7b08eep+1
+-0x1.cf4cp-5
+-0x1.c170fap+0
+-0x1.091188p+0
+0x1.0710a6p+1
+0x1.80909ep+1
+-0x1.64bf9ap+1
+-0x1.97fe52p+0
+-0x1.02ad28p-1
+-0x1.629852p+1
+-0x1.94736ep+0
+-0x1.a0db6p-2
+0x1.ec47dp-2
+-0x1.53912p-2
+-0x1.4056ep-3
+-0x1.40fe04p+1
+-0x1.6b6b8p-3
+0x1.0be28ap+1
+0x1.45844cp+0
+0x1.d39394p+0
+-0x1.133508p+1
+-0x1.6428f2p+0
+-0x1.8035dep+1
+-0x1.dd275p-1
+0x1.b64abp-1
+-0x1.0e9aecp+0
+0x1.7e28aep+1
+0x1.bcf23cp+0
+0x1.3bd9b4p+0
+0x1.ce034cp+0
+-0x1.7f0ca8p+1
+0x1.6d8198p-1
+-0x1.5b7d84p+1
+0x1.62ffd4p+0
+0x1.19cd3ap+1
+0x1.98f5cp-3
+0x1.dbfce8p-1
+-0x1.6c245ep+0
+0x1.7a679p-1
+-0x1.272f3p-2
+-0x1.18f068p-1
+0x1.8fab04p+0
+0x1.1efe28p-1
+0x1.30b32ep+1
+-0x1.65f8cep+1
+0x1.1f961cp+0
+-0x1.04c3ep-2
+-0x1.1be844p+0
+0x1.83f3dap+1
+0x1.1a749ep+1
+-0x1.e80ec4p+0
+0x1.0ee56ep+1
+0x1.aa5c38p-1
+0x1.8ef56ap+1
+0x1.1cbc3ep+1
+0x1.10082ep+1
+-0x1.aeb42p-1
+-0x1.2eeb5cp+0
+-0x1.152eep+0
+-0x1.9d4bfcp+0
+-0x1.8e0a6ep+1
+-0x1.13b0fp+0
+0x1.0b05c2p+1
+0x1.2169b4p+0
+0x1.22f61p-2
+0x1.67e5ep-2
+0x1.b0cbb8p-1
+0x1.8055p-1
+-0x1.f7361p-2
+0x1.91e08ep+1
+0x1.153fdep+1
+-0x1.3da458p-1
+0x1.8f1a4ep+1
+0x1.256e4ep+1
+0x1.6df7bp-2
+-0x1.16bap-4
+-0x1.33d9p-3
+-0x1.0c0e18p-1
+-0x1.6111fp+1
+-0x1.34d908p+1
+-0x1.7b878p+0
+0x1.10591ap+1
+0x1.7b5ad6p+1
+-0x1.030522p+1
+0x1.596d7p-2
+0x1.0cbd1ep+1
+0x1.2147ep-2
+-0x1.0c6a9p+1
+-0x1.ec9204p+0
+0x1.27dbf4p+0
+0x1.42a8f2p+1
+-0x1.806a68p-1
+-0x1.212754p+1
+0x1.08637ep+1
+0x1.bd3108p-1
+-0x1.837438p-1
+-0x1.775e7p+0
+-0x1.31b65ep+0
+-0x1.1e98eap+1
+-0x1.92f336p+0
+-0x1.33be58p+1
+-0x1.00ed38p+0
+0x1.42596ap+1
+0x1.37a502p+1
+-0x1.ff2832p+0
+-0x1.4d938p-3
+0x1.f6133cp+0
+0x1.a4f2ap-1
+0x1.6032f4p+0
+0x1.246c6p-1
+-0x1.90bd5ap+0
+-0x1.cc7b2ep+0
+0x1.829b8ep+1
+0x1.89a044p+0
+-0x1.1343fp-2
+-0x1.5ed49p-2
+-0x1.677cfcp+1
+0x1.8ac852p+1
+0x1.05ada8p-1
+0x1.92412p-1
+-0x1.640252p+1
+0x1.3e0d4cp+0
+0x1.d523bcp+0
+-0x1.0796cp-4
+-0x1.bc919p-1
+0x1.2d3b36p+1
+0x1.b082ep-2
+-0x1.2856fap+0
+-0x1.53dea4p+1
+0x1.7db6dep+1
+-0x1.86dcp-4
+-0x1.97908p+0
+0x1.436106p+1
+-0x1.2cd0a8p-1
+0x1.47d062p+1
+-0x1.4b939cp+1
+-0x1.5e0ea8p+0
+0x1.d003fcp+0
+0x1.69b1cap+1
+-0x1.354dcap+1
+0x1.76fb5cp+0
+0x1.d6ed48p-1
+0x1.0b9b3ep+1
+0x1.33201ep+1
+0x1.86ec44p+0
+-0x1.cdd6ap+0
+0x1.e1c444p+0
+-0x1.c58aap-2
+0x1.8eca3cp+0
+-0x1.149068p-1
+0x1.528b08p-1
+-0x1.e21f0ap+0
+0x1.26385ep+1
+-0x1.693ec8p+1
+-0x1.6d013ep+0
+0x1.4b1588p-1
+-0x1.b03328p+0
+-0x1.0c964p-4
+-0x1.43741p+1
+-0x1.71f324p+1
+-0x1.a9eccp-1
+-0x1.64b038p+0
+0x1.adep-8
+-0x1.6d282cp+1
+0x1.636b4p-3
+0x1.5c27b4p+0
+-0x1.07bcccp+0
+0x1.78c604p+0
+-0x1.ae7a68p-1
+-0x1.07dc4p-4
+-0x1.fb0a4ep+0
+-0x1.06f4cp-4
+0x1.ba1214p+0
+0x1.e1d8b8p-1
+0x1.339f36p+1
+-0x1.335c68p+1
+-0x1.08724cp+0
+-0x1.16b78p+0
+-0x1.c6943p+0
+0x1.eccbf8p-1
+-0x1.49402ap+1
+0x1.3928e6p+1
+0x1.16769ap+1
+0x1.ae0304p+0
+0x1.daa718p-1
+-0x1.46763ep+0
+-0x1.0aeab8p+0
+0x1.59414p-4
+0x1.7a938ep+1
+0x1.4a1de2p+1
+-0x1.d1fd92p+0
+-0x1.1444d8p-1
+-0x1.1b36cp+1
+0x1.6ebc2ep+1
+-0x1.2f45bp-2
+-0x1.59b22ap+0
+-0x1.c4495p-1
+0x1.572dep-2
+0x1.72429ep+1
+-0x1.31f344p+1
+0x1.fc1c0cp+0
+0x1.26c5b4p+0
+0x1.1edc2p-2
+0x1.1343cap+1
+0x1.564782p+1
+-0x1.7c3738p-1
+-0x1.4f36bap+1
+-0x1.6d0a4p+0
+-0x1.a9a28cp+0
+-0x1.4d9358p+1
+0x1.9d398p-5
+-0x1.c8fbbp-2
+0x1.9e9ed4p+0
+0x1.05955ep+1
+-0x1.853c54p+1
+-0x1.0947ecp+0
+0x1.59aa88p-1
+-0x1.12f16p-1
+-0x1.557e8cp+1
+-0x1.7efe7cp+1
+0x1.b34adcp+0
+0x1.059feep+1
+0x1.2fedb2p+1
+0x1.5d09fap+1
+0x1.cdd238p-1
+-0x1.818964p+0
+-0x1.5be986p+1
+0x1.450fa6p+1
+0x1.7b7c7p-2
+0x1.e62a6cp+0
+-0x1.5314cp-1
+0x1.8967dep+1
+0x1.f2607cp+0
+0x1.88b3fep+1
+-0x1.2cab9p+1
+-0x1.132bfp+1
+-0x1.80ccbcp+1
+-0x1.752394p+1
+0x1.62b3ecp+0
+0x1.9534d4p+0
+-0x1.0bc89p-2
+0x1.89d59ep+1
+0x1.b0d234p+0
+-0x1.8fdf0cp+1
+-0x1.5656fcp+1
+-0x1.d264d8p-1
+0x1.18f3cep+1
+0x1.c815f4p+0
+-0x1.482752p+1
+0x1.fb586cp+0
+0x1.3ee584p+0
+0x1.786efp-1
+-0x1.14d3ep+1
+-0x1.143448p-1
+-0x1.7b46p-4
+0x1.f7a6fcp+0
+-0x1.3a0c1p+1
+0x1.607b38p-1
+-0x1.81997cp+1
+-0x1.1eaab8p+0
+-0x1.1b321cp+1
+-0x1.08fd8cp+0
+0x1.ca8c78p-1
+-0x1.0eb7e2p+1
+-0x1.4cd688p+1
+0x1.528142p+1
+0x1.71adp-6
+0x1.1d37c2p+1
+0x1.52c102p+1
+0x1.4e3abcp+0
+0x1.077ecap+1
+0x1.798b22p+1
+-0x1.1bcc2p+0
+-0x1.2859eep+1
+-0x1.178e88p-1
+0x1.7a5722p+1
+0x1.7fab02p+1
+-0x1.2c68cap+0
+0x1.5e39dp-2
+-0x1.a8a9f8p-1
+0x1.2628c2p+1
+0x1.bf4de4p+0
+-0x1.0992bcp+0
+0x1.5ccb7p-2
+0x1.a0c15p-1
+0x1.fc17fcp+0
+0x1.b604cp-4
+0x1.4472ap-2
+-0x1.7a4e5ep+1
+0x1.7f0aecp+0
+0x1.2beb9ap+1
+-0x1.088072p+1
+0x1.90ce76p+1
+-0x1.82e96p-3
+-0x1.1943aep+1
+0x1.3ba0b4p+0
+-0x1.f1676p-3
+0x1.0d1bfep+1
+-0x1.513e8ap+0
+0x1.1129d4p+0
+0x1.9c8e1cp+0
+-0x1.99219ap+0
+0x1.880c4p-3
+0x1.768b3p-2
+0x1.3b393ap+1
+0x1.7dbd3ep+1
+-0x1.8d86p+1
+-0x1.228ed6p+1
+-0x1.e5ce4p-4
+-0x1.9f094ap+0
+0x1.08e972p+1
+0x1.d73ccp-2
+-0x1.1becp-3
+0x1.0b7f84p+0
+0x1.81758p-2
+-0x1.3108c8p-1
+0x1.251142p+1
+0x1.72fba2p+1
+-0x1.bb8bd4p+0
+0x1.5bc41ep+1
+-0x1.6fe8e8p+1
+0x1.90caaep+1
+-0x1.114494p+1
+0x1.eb365cp+0
+-0x1.2c2314p+1
+-0x1.4238d4p+0
+0x1.b7d6e8p-1
+-0x1.065458p-1
+0x1.7c97b2p+1
+-0x1.6f8164p+1
+-0x1.484abp-2
+0x1.589deap+1
+-0x1.b17cf8p+0
+-0x1.7bb86cp+1
+-0x1.fddfaap+0
+0x1.34806ap+1
+0x1.27eap-7
+0x1.f3d518p-1
+0x1.176486p+1
+-0x1.f421fap+0
+0x1.0a84e4p+0
+-0x1.1154b8p+0
+-0x1.3d448p-5
+0x1.446782p+1
+0x1.0b6806p+1
+0x1.434c1cp+0
+0x1.3e3aa8p-1
+-0x1.586eecp+1
+0x1.545318p-1
+0x1.7f4bp-5
+0x1.f530d8p-1
+0x1.65bfeep+1
+0x1.202e1cp+0
+0x1.0772dcp+0
+-0x1.96602cp+0
+-0x1.1bdcdp+0
+-0x1.41772p-2
+0x1.a286bcp+0
+0x1.b8b838p-1
+-0x1.8499c2p+1
+0x1.551fbp-1
+0x1.26cfd4p+0
+0x1.705ff6p+1
+0x1.62bb0cp+0
+-0x1.6f193cp+1
+0x1.6ab2fep+1
+-0x1.390086p+1
+-0x1.4873ep-2
+0x1.aebe8p-5
+-0x1.191692p+1
+-0x1.86af7p-1
+-0x1.710d6p-1
+-0x1.2ff2p-1
+0x1.574a8p-2
+-0x1.8cc4aap+0
+0x1.52a2fcp+0
+0x1.3092dap+1
+-0x1.0d1bep-1
+0x1.622ebp-2
+0x1.476fd4p+0
+0x1.1b97d2p+1
+0x1.779b0ap+1
+0x1.06f586p+1
+0x1.a6c81cp+0
+-0x1.406024p+1
+-0x1.c42138p-1
+-0x1.9c19f8p-1
+-0x1.e558p-7
+0x1.31ccaap+1
+-0x1.776e8p+1
+0x1.f06a34p+0
+-0x1.6b4f4p-4
+-0x1.a457a8p+0
+-0x1.6dafap-1
+0x1.8c6936p+1
+0x1.6c1b4p-1
+0x1.9ab674p+0
+0x1.8d1666p+1
+0x1.936204p+0
+-0x1.316508p-1
+0x1.8326aap+1
+-0x1.40e722p+1
+-0x1.026ea4p+0
+-0x1.09f2a6p+1
+0x1.bf2444p+0
+0x1.b8f5c8p-1
+-0x1.6dc48p+0
+0x1.ad0edp-1
+-0x1.490c4cp+1
+-0x1.2eb71ap+1
+-0x1.002178p-1
+-0x1.c664ep-1
+0x1.0db44p-2
+-0x1.7bbf28p+1
+0x1.ac016p-1
+0x1.26eeb8p-1
+-0x1.c2e3bp-1
+0x1.1b0e86p+1
+0x1.a395fcp+0
+0x1.4eb464p+0
+0x1.d80b04p+0
+0x1.076eb6p+1
+0x1.f62d68p-1
+-0x1.429b02p+1
+0x1.9f000cp+0
+0x1.d77824p+0
+0x1.0be1f2p+1
+0x1.f27be8p-1
+0x1.e7bfecp+0
+0x1.660502p+1
+-0x1.25ab36p+0
+0x1.86873ep+1
+0x1.1e425cp+0
+0x1.2ae69p-1
+-0x1.49621cp+1
+-0x1.3304fap+1
+-0x1.63978p-3
+-0x1.640f3cp+1
+0x1.cd6d88p-1
+-0x1.db0348p+0
+-0x1.209076p+1
+-0x1.1e67b2p+1
+-0x1.76684ep+0
+-0x1.ce5dfp-1
+0x1.386d4ap+1
+0x1.a2a12p-3
+-0x1.678148p+0
+-0x1.59bd7p+1
+-0x1.4480bep+0
+0x1.e7ae7cp+0
+-0x1.ac425ep+0
+0x1.07d41cp+0
+-0x1.c68fap+0
+0x1.112496p+1
+0x1.0d9518p-1
+0x1.51467ep+1
+0x1.f21fd4p+0
+-0x1.e77a88p-1
+0x1.36e4bcp+0
+0x1.8d34fep+1
+-0x1.932e22p+0
+0x1.55a2fcp+0
+-0x1.ba8418p+0
+0x1.3ccdb4p+0
+0x1.8d7984p+0
+0x1.126794p+0
+0x1.69613cp+0
+0x1.eab98p-4
+0x1.7ab222p+1
+-0x1.2f5598p-1
+0x1.8b0b74p+0
+-0x1.604eb8p+0
+-0x1.680a7ap+0
+-0x1.7c0c2p-3
+-0x1.354708p+1
+-0x1.5a131ap+0
+-0x1.38cfep-1
+-0x1.b2684ap+0
+-0x1.efdf7p-2
+-0x1.09da9ap+1
+0x1.8330acp+0
+-0x1.d2e446p+0
+0x1.904b1ep+1
+0x1.8eff8cp+0
+0x1.20a8cp-1
+0x1.0ed578p-1
+-0x1.11fe5p-2
+0x1.aeed54p+0
+-0x1.cfa1f6p+0
+-0x1.69135ap+1
+0x1.ff9384p+0
+0x1.476f6ep+1
+-0x1.06d3dep+1
+0x1.8559f6p+1
+-0x1.4ef01p+1
+-0x1.70d9f8p+1
+-0x1.208e5p+0
+-0x1.2331fp-1
+-0x1.0c166ap+1
+-0x1.5fcdfep+1
+0x1.860d1p-2
+-0x1.3e7458p-1
+0x1.948404p+0
+-0x1.a0d89p+0
+0x1.525966p+1
+-0x1.8f5be2p+0
+0x1.c446f8p-1
+-0x1.4620dp-1
+0x1.02722cp+0
+0x1.7dfa4ap+1
+0x1.89c24ap+1
+-0x1.f0526cp+0
+-0x1.9d99p-4
+-0x1.48834p-1
+-0x1.de146p+0
+-0x1.443b58p+1
+0x1.b5340cp+0
+0x1.d4621cp+0
+0x1.17a318p-1
+-0x1.45177p-2
+-0x1.546d16p+0
+-0x1.ec21bp-2
+0x1.63d5b2p+1
+0x1.01153cp+0
+0x1.75fce4p+0
+-0x1.8295bep+0
+-0x1.35b814p+1
+-0x1.64a3d4p+1
+0x1.60b5p-4
+0x1.0f7f86p+1
+-0x1.d22edcp+0
+-0x1.3a3a5p-1
+0x1.0c05dap+1
+0x1.13129p-1
+0x1.47a8ap-1
+-0x1.086134p+0
+-0x1.7e3d3ap+1
+0x1.2b947p-2
+-0x1.5a44a4p+1
+-0x1.7ffc7ap+0
+-0x1.74d1fep+0
+0x1.620e5ap+1
+-0x1.287dp-4
+0x1.2e8b92p+1
+-0x1.7cfaf2p+1
+0x1.1d3f36p+1
+0x1.7e282p-3
+0x1.c01048p-1
+-0x1.6f4ce8p-1
+0x1.78ab4p-2
+-0x1.6b7cdp-2
+0x1.8983bep+1
+-0x1.4dca48p+1
+-0x1.7f62a8p+1
+0x1.2c2cfp-1
+0x1.940eccp+0
+-0x1.11b96p-2
+-0x1.6eabp-3
+0x1.22fbap-1
+0x1.6a16a4p+0
+0x1.54a4f6p+1
+-0x1.cb280ap+0
+0x1.03c7dep+1
+-0x1.fbc44p-1
+0x1.426c5cp+0
+-0x1.a18a2p-3
+-0x1.1c2fcp+1
+0x1.a16808p-1
+-0x1.c5b714p+0
+0x1.1e8cbcp+0
+0x1.9b8e78p-1
+0x1.f41d98p-1
+-0x1.13bf68p+0
+-0x1.9f983ap+0
+0x1.8e608ep+1
+0x1.452324p+0
+0x1.050c0ap+1
+0x1.eaef04p+0
+-0x1.cb9062p+0
+0x1.9c8bap-2
+-0x1.10b60ap+1
+-0x1.7b36dp-2
+0x1.481a72p+1
+-0x1.26bc64p+1
+-0x1.0844f4p+1
+0x1.1d886ep+1
+0x1.7ef4p-5
+0x1.1c38fp-2
+0x1.6c3c86p+1
+-0x1.a88d7p+0
+-0x1.4fd71p-1
+0x1.529a0ap+1
+0x1.6340ap-3
+-0x1.cd7p-10
+0x1.d50bbcp+0
+0x1.2c04p-4
+-0x1.d7664p-2
+-0x1.422ca6p+1
+0x1.ad7204p+0
+0x1.726384p+0
+0x1.ec81a8p-1
+0x1.da41ep-2
+-0x1.ac6ea8p-1
+-0x1.02ba5cp+1
+0x1.fa6a08p-1
+-0x1.ab48e6p+0
+0x1.16acd2p+1
+-0x1.ecdcc6p+0
+0x1.ab6608p-1
+-0x1.fe9c9p-2
+0x1.0e563cp+0
+-0x1.c08cb4p+0
+0x1.e9f608p-1
+-0x1.693684p+0
+-0x1.bbc5a6p+0
+0x1.d0abap-2
+-0x1.1c34d8p+0
+0x1.1f1056p+1
+-0x1.2348p-7
+0x1.65ad2cp+0
+0x1.0488eap+1
+-0x1.403ec6p+1
+-0x1.4f6efcp+1
+0x1.22905cp+0
+0x1.cab11p-2
+0x1.49cd7cp+0
+0x1.d61cfp-2
+0x1.01943p-2
+-0x1.d6a45p-1
+0x1.f5f8c8p-1
+-0x1.7db07ep+1
+-0x1.75fd0ep+1
+0x1.77ae12p+1
+-0x1.7eda9p-1
+-0x1.409f12p+0
+-0x1.be6678p-1
+-0x1.38b0bp+0
+-0x1.adb13ap+0
+0x1.3282ccp+0
+-0x1.e1f846p+0
+-0x1.4ecb8p-2
+0x1.628e06p+1
+0x1.4ad9f2p+1
+0x1.8ce34p-2
+-0x1.82fb6ap+0
+0x1.75e882p+1
+-0x1.d1eed8p-1
+-0x1.854a28p+0
+0x1.1c14fep+1
+-0x1.f92ccap+0
+0x1.820d6ep+1
+-0x1.1eeba4p+1
+-0x1.8759p-6
+0x1.57d46p-1
+0x1.00e18ep+1
+0x1.8d7f14p+0
+0x1.40b6bap+1
+0x1.4ffcacp+0
+-0x1.ef095ap+0
+0x1.4e2332p+1
+-0x1.ab07ep+0
+0x1.168p-8
+0x1.26f68ep+1
+0x1.ef4fp-2
+-0x1.cb7538p-1
+-0x1.4c4b4ap+1
+-0x1.552346p+0
+0x1.87bdbep+1
+-0x1.7e57dap+1
+-0x1.992a08p-1
+0x1.142f4ap+1
+-0x1.199afap+1
+0x1.c28cfp-2
+-0x1.8cb33p-2
+-0x1.b01d74p+0
+-0x1.91985p-1
+-0x1.6907c8p-1
+-0x1.283702p+0
+-0x1.7bd4f8p-1
+-0x1.4b8a3ep+1
+-0x1.6c8a28p+1
+-0x1.d887fp-2
+-0x1.1eb244p+1
+-0x1.00eb74p+1
+-0x1.5f80dp-2
+-0x1.493a06p+0
+-0x1.60afbp-2
+-0x1.db6332p+0
+-0x1.b7e74cp+0
+0x1.8dbf32p+1
+0x1.80e7ep-3
+-0x1.b31eaep+0
+0x1.80cbf2p+1
+0x1.410f42p+1
+0x1.5e8262p+1
+-0x1.a3578p-1
+0x1.12223cp+0
+0x1.3d05aep+1
+0x1.92d15p-2
+0x1.923214p+0
+0x1.91513ep+1
+-0x1.1c49d2p+1
+0x1.5258p-7
+-0x1.31671cp+1
+-0x1.86ec84p+0
+0x1.be0d5cp+0
+-0x1.8ebf1p+0
+-0x1.70d05cp+1
+-0x1.3dd536p+1
+-0x1.aacbp-6
+0x1.01508ap+1
+0x1.ebdaccp+0
+0x1.0faf4ep+1
+-0x1.3877a8p+1
+0x1.88932p-1
+-0x1.75cp-4
+-0x1.ff111p-2
+-0x1.02bfp-3
+0x1.39afcp-2
+0x1.511056p+1
+-0x1.672858p-1
+-0x1.415b7p+1
+0x1.15cfcap+1
+-0x1.18d5f8p+1
+0x1.e9ab98p-1
+0x1.9c0024p+0
+-0x1.3b5e2p-2
+0x1.30161cp+0
+0x1.26b75ap+1
+-0x1.0b19c8p-1
+-0x1.6cb1dap+1
+-0x1.f8aca2p+0
+-0x1.d132e2p+0
+0x1.2cd414p+0
+0x1.04fa16p+1
+-0x1.019984p+0
+0x1.2803d2p+1
--
2.43.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 06/11] math: Use cbrtf from CORE-MATH
2024-11-11 13:45 [PATCH 00/11] Add more CORE-math implementations to libm Adhemerval Zanella
` (4 preceding siblings ...)
2024-11-11 13:45 ` [PATCH 05/11] benchtests: Add tanf benchmark Adhemerval Zanella
@ 2024-11-11 13:45 ` Adhemerval Zanella
2024-11-20 22:20 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 07/11] math: Split s_erfF in erff and erfc Adhemerval Zanella
` (4 subsequent siblings)
10 siblings, 1 reply; 34+ messages in thread
From: Adhemerval Zanella @ 2024-11-11 13:45 UTC (permalink / raw)
To: libc-alpha; +Cc: Alexei Sibidanov, Paul Zimmermann
The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance to the generic cbrtf.
The code was adapted to glibc style and to use the definition of
math_config.h.
Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (M1,
gcc 13.2.1), and powerpc (POWER10, gcc 13.2.1):
latency master patched improvement
x86_64 68.6348 36.8908 46.25%
x86_64v2 67.3418 36.6968 45.51%
x86_64v3 63.4981 32.7859 48.37%
aarch64 29.3172 12.1496 58.56%
power10 18.0845 8.8893 50.85%
powerpc 18.0859 8.79527 51.37%
reciprocal-throughput master patched improvement
x86_64 36.4369 13.3565 63.34%
x86_64v2 37.3611 13.1149 64.90%
x86_64v3 31.6024 11.2102 64.53%
aarch64 18.6866 7.3474 60.68%
power10 9.4758 3.6329 61.66%
powerpc 9.58896 3.90439 59.28%
Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
---
SHARED-FILES | 4 +
sysdeps/aarch64/libm-test-ulps | 4 -
sysdeps/alpha/fpu/libm-test-ulps | 4 -
sysdeps/arc/fpu/libm-test-ulps | 4 -
sysdeps/arc/nofpu/libm-test-ulps | 1 -
sysdeps/arm/libm-test-ulps | 4 -
sysdeps/csky/fpu/libm-test-ulps | 4 -
sysdeps/csky/nofpu/libm-test-ulps | 4 -
sysdeps/hppa/fpu/libm-test-ulps | 4 -
sysdeps/ieee754/flt-32/s_cbrtf.c | 136 ++++++++++++++++---------
sysdeps/loongarch/lp64/libm-test-ulps | 4 -
sysdeps/m68k/m680x0/fpu/libm-test-ulps | 4 -
sysdeps/microblaze/libm-test-ulps | 1 -
sysdeps/mips/mips32/libm-test-ulps | 4 -
sysdeps/mips/mips64/libm-test-ulps | 4 -
sysdeps/nios2/libm-test-ulps | 1 -
sysdeps/or1k/fpu/libm-test-ulps | 4 -
sysdeps/or1k/nofpu/libm-test-ulps | 4 -
sysdeps/powerpc/fpu/libm-test-ulps | 4 -
sysdeps/powerpc/nofpu/libm-test-ulps | 4 -
sysdeps/riscv/nofpu/libm-test-ulps | 4 -
sysdeps/riscv/rvd/libm-test-ulps | 4 -
sysdeps/s390/fpu/libm-test-ulps | 4 -
sysdeps/sh/libm-test-ulps | 2 -
sysdeps/sparc/fpu/libm-test-ulps | 4 -
sysdeps/x86_64/fpu/libm-test-ulps | 4 -
26 files changed, 91 insertions(+), 134 deletions(-)
diff --git a/SHARED-FILES b/SHARED-FILES
index 228f415dfd..d367f4b62f 100644
--- a/SHARED-FILES
+++ b/SHARED-FILES
@@ -268,3 +268,7 @@ sysdeps/ieee754/flt-32/s_log10p1f.c
(file src/binary32/log10p1/log10p1f.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
+sysdeps/ieee754/flt-32/s_cbrtf.c
+ (file src/binary32/cbrt/cbrtf.c in CORE-MATH)
+ - The code was adapted to use glibc code style and internal
+ functions to handle errno, overflow, and underflow.
diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulps
index c523d45802..4979769b58 100644
--- a/sysdeps/aarch64/libm-test-ulps
+++ b/sysdeps/aarch64/libm-test-ulps
@@ -474,7 +474,6 @@ ldouble: 2
Function: "cbrt":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_advsimd":
@@ -483,7 +482,6 @@ float: 1
Function: "cbrt_downward":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_sve":
@@ -492,12 +490,10 @@ float: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
ldouble: 1
Function: "cbrt_upward":
double: 5
-float: 1
ldouble: 1
Function: Real part of "ccos":
diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
index 212c52c8cc..a2b5404f9d 100644
--- a/sysdeps/alpha/fpu/libm-test-ulps
+++ b/sysdeps/alpha/fpu/libm-test-ulps
@@ -417,22 +417,18 @@ ldouble: 2
Function: "cbrt":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_downward":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
ldouble: 1
Function: "cbrt_upward":
double: 5
-float: 1
ldouble: 1
Function: Real part of "ccos":
diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
index 7812a11b5b..c6f3646797 100644
--- a/sysdeps/arc/fpu/libm-test-ulps
+++ b/sysdeps/arc/fpu/libm-test-ulps
@@ -337,19 +337,15 @@ float: 2
Function: "cbrt":
double: 4
-float: 1
Function: "cbrt_downward":
double: 4
-float: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
Function: "cbrt_upward":
double: 5
-float: 1
Function: Real part of "ccos":
double: 3
diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps
index d0cfa46c3d..6319012db5 100644
--- a/sysdeps/arc/nofpu/libm-test-ulps
+++ b/sysdeps/arc/nofpu/libm-test-ulps
@@ -84,7 +84,6 @@ float: 1
Function: "cbrt":
double: 4
-float: 1
Function: Real part of "ccos":
double: 1
diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
index 6cdd3d53d6..d9317046a9 100644
--- a/sysdeps/arm/libm-test-ulps
+++ b/sysdeps/arm/libm-test-ulps
@@ -333,19 +333,15 @@ float: 1
Function: "cbrt":
double: 4
-float: 1
Function: "cbrt_downward":
double: 4
-float: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
Function: "cbrt_upward":
double: 5
-float: 1
Function: Real part of "ccos":
double: 1
diff --git a/sysdeps/csky/fpu/libm-test-ulps b/sysdeps/csky/fpu/libm-test-ulps
index a7b2bec17e..c3a3db9bcb 100644
--- a/sysdeps/csky/fpu/libm-test-ulps
+++ b/sysdeps/csky/fpu/libm-test-ulps
@@ -330,19 +330,15 @@ float: 1
Function: "cbrt":
double: 4
-float: 1
Function: "cbrt_downward":
double: 4
-float: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
Function: "cbrt_upward":
double: 5
-float: 1
Function: Real part of "ccos":
double: 1
diff --git a/sysdeps/csky/nofpu/libm-test-ulps b/sysdeps/csky/nofpu/libm-test-ulps
index 4e4451a5d2..68a74bf1d0 100644
--- a/sysdeps/csky/nofpu/libm-test-ulps
+++ b/sysdeps/csky/nofpu/libm-test-ulps
@@ -328,19 +328,15 @@ float: 1
Function: "cbrt":
double: 4
-float: 1
Function: "cbrt_downward":
double: 4
-float: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
Function: "cbrt_upward":
double: 5
-float: 1
Function: Real part of "ccos":
double: 1
diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
index 021a2a482c..a54737db2e 100644
--- a/sysdeps/hppa/fpu/libm-test-ulps
+++ b/sysdeps/hppa/fpu/libm-test-ulps
@@ -338,20 +338,16 @@ float: 1
Function: "cbrt":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_downward":
double: 4
-float: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
Function: "cbrt_upward":
double: 5
-float: 1
Function: Real part of "ccos":
double: 1
diff --git a/sysdeps/ieee754/flt-32/s_cbrtf.c b/sysdeps/ieee754/flt-32/s_cbrtf.c
index 68b8b0ec37..5a7a9a952d 100644
--- a/sysdeps/ieee754/flt-32/s_cbrtf.c
+++ b/sysdeps/ieee754/flt-32/s_cbrtf.c
@@ -1,61 +1,99 @@
-/* Compute cubic root of float value.
- Copyright (C) 1997-2024 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+/* Correctly-rounded cubic root of binary32 value.
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
+Copyright (c) 2023, 2024 Alexei Sibidanov.
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
+The original version of this file was copied from the CORE-MATH
+project (file src/binary32/cbrt/cbrtf.c, revision bc385c2).
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
-#include <math.h>
-#include <libm-alias-float.h>
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
-#define CBRT2 1.2599210498948731648 /* 2^(1/3) */
-#define SQR_CBRT2 1.5874010519681994748 /* 2^(2/3) */
-
-static const double factor[5] =
-{
- 1.0 / SQR_CBRT2,
- 1.0 / CBRT2,
- 1.0,
- CBRT2,
- SQR_CBRT2
-};
-
+#include <fenv.h>
+#include <libm-alias-float.h>
+#include <math.h>
+#include <stdint.h>
+#include "math_config.h"
float
__cbrtf (float x)
{
- float xm, ym, u, t2;
- int xe;
-
- /* Reduce X. XM now is an range 1.0 to 0.5. */
- xm = __frexpf (fabsf (x), &xe);
-
- /* If X is not finite or is null return it (with raising exceptions
- if necessary.
- Note: *Our* version of `frexp' sets XE to zero if the argument is
- Inf or NaN. This is not portable but faster. */
- if (xe == 0 && fpclassify (x) <= FP_ZERO)
- return x + x;
-
- u = (0.492659620528969547 + (0.697570460207922770
- - 0.191502161678719066 * xm) * xm);
-
- t2 = u * u * u;
-
- ym = u * (t2 + 2.0 * xm) / (2.0 * t2 + xm) * factor[2 + xe % 3];
-
- return __ldexpf (x > 0.0 ? ym : -ym, xe / 3);
+ static const union
+ {
+ double d;
+ uint64_t u;
+ } escale[3] =
+ {
+ { .d = 1.0 },
+ { .d = 0x1.428a2f98d728bp+0 }, /* 2^(1/3) */
+ { .d = 0x1.965fea53d6e3dp+0 }, /* 2^(2/3) */
+ };
+ uint32_t u = asuint (x);
+ uint32_t au = u << 1;
+ uint32_t sgn = u >> 31;
+ uint32_t e = au >> 24;
+ if (__glibc_unlikely (au < 1u << 24 || au >= 0xffu << 24))
+ {
+ if (au >= 0xffu << 24)
+ return x + x; /* inf, nan */
+ if (au == 0)
+ return x; /* +-0 */
+ int nz = __builtin_clz (au) - 7; /* subnormal */
+ au <<= nz;
+ e -= nz - 1;
+ }
+ uint32_t mant = au & 0xffffff;
+ e += 899;
+ uint32_t et = e / 3, it = e % 3;
+ uint64_t isc = escale[it].u;
+ isc += (int64_t) (et - 342) << 52;
+ isc |= (int64_t) sgn << 63;
+ double cvt2 = asdouble (isc);
+ static const double c[] =
+ {
+ 0x1.2319d352ea5d5p-1, 0x1.67ad8ee258d1ap-1, -0x1.9342edf9cbad9p-2,
+ 0x1.b6388fc510a75p-3, -0x1.6002455599e2fp-4, 0x1.7b096936192c4p-6,
+ -0x1.e5577187e8bf8p-9, 0x1.169ef81d6c34ep-12
+ };
+ double z = asdouble ((uint64_t) mant << 28 | UINT64_C(0x3ff) << 52);
+ double r0 = -0x1.9931c6c2d19d1p-6 / z;
+ double z2 = z * z;
+ double z4 = z2 * z2;
+ double f = ((c[0] + z * c[1]) + z2 * (c[2] + z * c[3]))
+ + z4 * ((c[4] + z * c[5]) + z2 * (c[6] + z * c[7])) + r0;
+ double r = f * cvt2;
+ float ub = r;
+ float lb = r - cvt2 * 1.4182e-9;
+ if (__glibc_likely (ub == lb))
+ return ub;
+ const double u0 = -0x1.ab16ec65d138fp+3;
+ double h = f * f * f - z;
+ f -= (f * r0 * u0) * h;
+ r = f * cvt2;
+ uint64_t cvt1 = asuint64 (r);
+ ub = r;
+ int64_t m0 = cvt1 << 19;
+ int64_t m1 = m0 >> 63;
+ if (__glibc_unlikely ((m0 ^ m1) < (UINT64_C(1) << 31)))
+ {
+ cvt1 = (cvt1 + (UINT64_C(1) << 31)) & UINT64_C(0xffffffff00000000);
+ ub = asdouble (cvt1);
+ }
+ return ub;
}
libm_alias_float (__cbrt, cbrt)
diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps
index ecd9cc5873..ba070f8224 100644
--- a/sysdeps/loongarch/lp64/libm-test-ulps
+++ b/sysdeps/loongarch/lp64/libm-test-ulps
@@ -417,22 +417,18 @@ ldouble: 2
Function: "cbrt":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_downward":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
ldouble: 1
Function: "cbrt_upward":
double: 5
-float: 1
ldouble: 1
Function: Real part of "ccos":
diff --git a/sysdeps/m68k/m680x0/fpu/libm-test-ulps b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
index 3964b83b81..8456a59010 100644
--- a/sysdeps/m68k/m680x0/fpu/libm-test-ulps
+++ b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
@@ -379,22 +379,18 @@ ldouble: 1
Function: "cbrt":
double: 1
-float: 1
ldouble: 1
Function: "cbrt_downward":
double: 1
-float: 1
ldouble: 1
Function: "cbrt_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "cbrt_upward":
double: 1
-float: 1
ldouble: 1
Function: Real part of "ccos":
diff --git a/sysdeps/microblaze/libm-test-ulps b/sysdeps/microblaze/libm-test-ulps
index 328e31582b..c89096defd 100644
--- a/sysdeps/microblaze/libm-test-ulps
+++ b/sysdeps/microblaze/libm-test-ulps
@@ -81,7 +81,6 @@ float: 1
Function: "cbrt":
double: 3
-float: 1
Function: Real part of "ccos":
double: 1
diff --git a/sysdeps/mips/mips32/libm-test-ulps b/sysdeps/mips/mips32/libm-test-ulps
index c319e0642c..cef264d649 100644
--- a/sysdeps/mips/mips32/libm-test-ulps
+++ b/sysdeps/mips/mips32/libm-test-ulps
@@ -333,19 +333,15 @@ float: 1
Function: "cbrt":
double: 4
-float: 1
Function: "cbrt_downward":
double: 4
-float: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
Function: "cbrt_upward":
double: 5
-float: 1
Function: Real part of "ccos":
double: 1
diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
index 365b860c54..724249d3ad 100644
--- a/sysdeps/mips/mips64/libm-test-ulps
+++ b/sysdeps/mips/mips64/libm-test-ulps
@@ -417,22 +417,18 @@ ldouble: 2
Function: "cbrt":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_downward":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
ldouble: 1
Function: "cbrt_upward":
double: 5
-float: 1
ldouble: 1
Function: Real part of "ccos":
diff --git a/sysdeps/nios2/libm-test-ulps b/sysdeps/nios2/libm-test-ulps
index 5240767c0e..dbccba13cb 100644
--- a/sysdeps/nios2/libm-test-ulps
+++ b/sysdeps/nios2/libm-test-ulps
@@ -84,7 +84,6 @@ float: 1
Function: "cbrt":
double: 4
-float: 1
Function: Real part of "ccos":
double: 1
diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps
index 9ced4b0052..df2b69ac75 100644
--- a/sysdeps/or1k/fpu/libm-test-ulps
+++ b/sysdeps/or1k/fpu/libm-test-ulps
@@ -333,19 +333,15 @@ float: 1
Function: "cbrt":
double: 4
-float: 1
Function: "cbrt_downward":
double: 4
-float: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
Function: "cbrt_upward":
double: 5
-float: 1
Function: Real part of "ccos":
double: 1
diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps
index c7ae0f002b..2263f3f0b7 100644
--- a/sysdeps/or1k/nofpu/libm-test-ulps
+++ b/sysdeps/or1k/nofpu/libm-test-ulps
@@ -333,19 +333,15 @@ float: 1
Function: "cbrt":
double: 4
-float: 1
Function: "cbrt_downward":
double: 4
-float: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
Function: "cbrt_upward":
double: 5
-float: 1
Function: Real part of "ccos":
double: 1
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index 8d0c18eed1..36fa54d97e 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -506,25 +506,21 @@ ldouble: 6
Function: "cbrt":
double: 4
-float: 1
float128: 1
ldouble: 1
Function: "cbrt_downward":
double: 4
-float: 1
float128: 1
ldouble: 5
Function: "cbrt_towardzero":
double: 3
-float: 1
float128: 1
ldouble: 3
Function: "cbrt_upward":
double: 5
-float: 1
float128: 2
ldouble: 2
diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
index 20036c779c..c32c8017b4 100644
--- a/sysdeps/powerpc/nofpu/libm-test-ulps
+++ b/sysdeps/powerpc/nofpu/libm-test-ulps
@@ -421,22 +421,18 @@ ldouble: 6
Function: "cbrt":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_downward":
double: 4
-float: 1
ldouble: 5
Function: "cbrt_towardzero":
double: 3
-float: 1
ldouble: 3
Function: "cbrt_upward":
double: 5
-float: 1
ldouble: 2
Function: Real part of "ccos":
diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps
index cccc864a7a..79927c2bd9 100644
--- a/sysdeps/riscv/nofpu/libm-test-ulps
+++ b/sysdeps/riscv/nofpu/libm-test-ulps
@@ -417,22 +417,18 @@ ldouble: 2
Function: "cbrt":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_downward":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
ldouble: 1
Function: "cbrt_upward":
double: 5
-float: 1
ldouble: 1
Function: Real part of "ccos":
diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps
index 14fc7633af..fbd5b8fed7 100644
--- a/sysdeps/riscv/rvd/libm-test-ulps
+++ b/sysdeps/riscv/rvd/libm-test-ulps
@@ -417,22 +417,18 @@ ldouble: 2
Function: "cbrt":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_downward":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
ldouble: 1
Function: "cbrt_upward":
double: 5
-float: 1
ldouble: 1
Function: Real part of "ccos":
diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
index a25bb505b3..ade5a39db4 100644
--- a/sysdeps/s390/fpu/libm-test-ulps
+++ b/sysdeps/s390/fpu/libm-test-ulps
@@ -417,22 +417,18 @@ ldouble: 2
Function: "cbrt":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_downward":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
ldouble: 1
Function: "cbrt_upward":
double: 5
-float: 1
ldouble: 1
Function: Real part of "ccos":
diff --git a/sysdeps/sh/libm-test-ulps b/sysdeps/sh/libm-test-ulps
index 8562796de8..b0040d7218 100644
--- a/sysdeps/sh/libm-test-ulps
+++ b/sysdeps/sh/libm-test-ulps
@@ -164,11 +164,9 @@ float: 2
Function: "cbrt":
double: 4
-float: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
Function: Real part of "ccos":
double: 1
diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
index 6ea02058e9..d78b46b97b 100644
--- a/sysdeps/sparc/fpu/libm-test-ulps
+++ b/sysdeps/sparc/fpu/libm-test-ulps
@@ -417,22 +417,18 @@ ldouble: 2
Function: "cbrt":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_downward":
double: 4
-float: 1
ldouble: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
ldouble: 1
Function: "cbrt_upward":
double: 5
-float: 1
ldouble: 1
Function: Real part of "ccos":
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index e3c811549c..327937929d 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -638,25 +638,21 @@ ldouble: 1
Function: "cbrt":
double: 4
-float: 1
float128: 1
ldouble: 1
Function: "cbrt_downward":
double: 4
-float: 1
float128: 1
ldouble: 1
Function: "cbrt_towardzero":
double: 3
-float: 1
float128: 1
ldouble: 1
Function: "cbrt_upward":
double: 5
-float: 1
float128: 1
ldouble: 1
--
2.43.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 07/11] math: Split s_erfF in erff and erfc
2024-11-11 13:45 [PATCH 00/11] Add more CORE-math implementations to libm Adhemerval Zanella
` (5 preceding siblings ...)
2024-11-11 13:45 ` [PATCH 06/11] math: Use cbrtf from CORE-MATH Adhemerval Zanella
@ 2024-11-11 13:45 ` Adhemerval Zanella
2024-11-20 22:40 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 08/11] math: Use erff from CORE-MATH Adhemerval Zanella
` (3 subsequent siblings)
10 siblings, 1 reply; 34+ messages in thread
From: Adhemerval Zanella @ 2024-11-11 13:45 UTC (permalink / raw)
To: libc-alpha
So we can eventually replace each implementation.
---
math/Makefile | 1 +
sysdeps/ieee754/dbl-64/s_erfc.c | 1 +
sysdeps/ieee754/float128/s_erfcf128.c | 1 +
sysdeps/ieee754/flt-32/s_erfcf.c | 173 ++++++++++++++++++++++++++
sysdeps/ieee754/flt-32/s_erff.c | 77 ------------
sysdeps/ieee754/ldbl-128/s_erfcl.c | 1 +
sysdeps/ieee754/ldbl-128ibm/s_erfcl.c | 1 +
sysdeps/ieee754/ldbl-96/s_erfcl.c | 1 +
8 files changed, 179 insertions(+), 77 deletions(-)
create mode 100644 sysdeps/ieee754/dbl-64/s_erfc.c
create mode 100644 sysdeps/ieee754/float128/s_erfcf128.c
create mode 100644 sysdeps/ieee754/flt-32/s_erfcf.c
create mode 100644 sysdeps/ieee754/ldbl-128/s_erfcl.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm/s_erfcl.c
create mode 100644 sysdeps/ieee754/ldbl-96/s_erfcl.c
diff --git a/math/Makefile b/math/Makefile
index b64c3eedd5..2d5e016496 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -201,6 +201,7 @@ libm-calls = \
s_ceilF \
s_cosF \
s_erfF \
+ s_erfcF \
s_expm1F \
s_fabsF \
s_floorF \
diff --git a/sysdeps/ieee754/dbl-64/s_erfc.c b/sysdeps/ieee754/dbl-64/s_erfc.c
new file mode 100644
index 0000000000..95d17c8c28
--- /dev/null
+++ b/sysdeps/ieee754/dbl-64/s_erfc.c
@@ -0,0 +1 @@
+/* Not required. */
diff --git a/sysdeps/ieee754/float128/s_erfcf128.c b/sysdeps/ieee754/float128/s_erfcf128.c
new file mode 100644
index 0000000000..95d17c8c28
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_erfcf128.c
@@ -0,0 +1 @@
+/* Not required. */
diff --git a/sysdeps/ieee754/flt-32/s_erfcf.c b/sysdeps/ieee754/flt-32/s_erfcf.c
new file mode 100644
index 0000000000..fdba278eff
--- /dev/null
+++ b/sysdeps/ieee754/flt-32/s_erfcf.c
@@ -0,0 +1,173 @@
+/* s_erfcf.c -- float version of s_erfc.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_erff.c,v 1.4 1995/05/10 20:47:07 jtc Exp $";
+#endif
+
+#include <errno.h>
+#include <fix-int-fp-convert-zero.h>
+#include <libm-alias-float.h>
+#include <math-narrow-eval.h>
+#include <math.h>
+#include <math_private.h>
+
+
+static const float
+tiny = 1e-30,
+half= 5.0000000000e-01, /* 0x3F000000 */
+one = 1.0000000000e+00, /* 0x3F800000 */
+two = 2.0000000000e+00, /* 0x40000000 */
+ /* c = (subfloat)0.84506291151 */
+erx = 8.4506291151e-01, /* 0x3f58560b */
+/*
+ * Coefficients for approximation to erf on [0,0.84375]
+ */
+pp0 = 1.2837916613e-01, /* 0x3e0375d4 */
+pp1 = -3.2504209876e-01, /* 0xbea66beb */
+pp2 = -2.8481749818e-02, /* 0xbce9528f */
+pp3 = -5.7702702470e-03, /* 0xbbbd1489 */
+pp4 = -2.3763017452e-05, /* 0xb7c756b1 */
+qq1 = 3.9791721106e-01, /* 0x3ecbbbce */
+qq2 = 6.5022252500e-02, /* 0x3d852a63 */
+qq3 = 5.0813062117e-03, /* 0x3ba68116 */
+qq4 = 1.3249473704e-04, /* 0x390aee49 */
+qq5 = -3.9602282413e-06, /* 0xb684e21a */
+/*
+ * Coefficients for approximation to erf in [0.84375,1.25]
+ */
+pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */
+pa1 = 4.1485610604e-01, /* 0x3ed46805 */
+pa2 = -3.7220788002e-01, /* 0xbebe9208 */
+pa3 = 3.1834661961e-01, /* 0x3ea2fe54 */
+pa4 = -1.1089469492e-01, /* 0xbde31cc2 */
+pa5 = 3.5478305072e-02, /* 0x3d1151b3 */
+pa6 = -2.1663755178e-03, /* 0xbb0df9c0 */
+qa1 = 1.0642088205e-01, /* 0x3dd9f331 */
+qa2 = 5.4039794207e-01, /* 0x3f0a5785 */
+qa3 = 7.1828655899e-02, /* 0x3d931ae7 */
+qa4 = 1.2617121637e-01, /* 0x3e013307 */
+qa5 = 1.3637083583e-02, /* 0x3c5f6e13 */
+qa6 = 1.1984500103e-02, /* 0x3c445aa3 */
+/*
+ * Coefficients for approximation to erfc in [1.25,1/0.35]
+ */
+ra0 = -9.8649440333e-03, /* 0xbc21a093 */
+ra1 = -6.9385856390e-01, /* 0xbf31a0b7 */
+ra2 = -1.0558626175e+01, /* 0xc128f022 */
+ra3 = -6.2375331879e+01, /* 0xc2798057 */
+ra4 = -1.6239666748e+02, /* 0xc322658c */
+ra5 = -1.8460508728e+02, /* 0xc3389ae7 */
+ra6 = -8.1287437439e+01, /* 0xc2a2932b */
+ra7 = -9.8143291473e+00, /* 0xc11d077e */
+sa1 = 1.9651271820e+01, /* 0x419d35ce */
+sa2 = 1.3765776062e+02, /* 0x4309a863 */
+sa3 = 4.3456588745e+02, /* 0x43d9486f */
+sa4 = 6.4538726807e+02, /* 0x442158c9 */
+sa5 = 4.2900814819e+02, /* 0x43d6810b */
+sa6 = 1.0863500214e+02, /* 0x42d9451f */
+sa7 = 6.5702495575e+00, /* 0x40d23f7c */
+sa8 = -6.0424413532e-02, /* 0xbd777f97 */
+/*
+ * Coefficients for approximation to erfc in [1/.35,28]
+ */
+rb0 = -9.8649431020e-03, /* 0xbc21a092 */
+rb1 = -7.9928326607e-01, /* 0xbf4c9dd4 */
+rb2 = -1.7757955551e+01, /* 0xc18e104b */
+rb3 = -1.6063638306e+02, /* 0xc320a2ea */
+rb4 = -6.3756646729e+02, /* 0xc41f6441 */
+rb5 = -1.0250950928e+03, /* 0xc480230b */
+rb6 = -4.8351919556e+02, /* 0xc3f1c275 */
+sb1 = 3.0338060379e+01, /* 0x41f2b459 */
+sb2 = 3.2579251099e+02, /* 0x43a2e571 */
+sb3 = 1.5367296143e+03, /* 0x44c01759 */
+sb4 = 3.1998581543e+03, /* 0x4547fdbb */
+sb5 = 2.5530502930e+03, /* 0x451f90ce */
+sb6 = 4.7452853394e+02, /* 0x43ed43a7 */
+sb7 = -2.2440952301e+01; /* 0xc1b38712 */
+
+float __erfcf(float x)
+{
+ int32_t hx,ix;
+ float R,S,P,Q,s,y,z,r;
+ GET_FLOAT_WORD(hx,x);
+ ix = hx&0x7fffffff;
+ if(ix>=0x7f800000) { /* erfc(nan)=nan */
+ /* erfc(+-inf)=0,2 */
+ float ret = (float)(((uint32_t)hx>>31)<<1)+one/x;
+ if (FIX_INT_FP_CONVERT_ZERO && ret == 0.0f)
+ return 0.0f;
+ return ret;
+ }
+
+ if(ix < 0x3f580000) { /* |x|<0.84375 */
+ if(ix < 0x32800000) /* |x|<2**-26 */
+ return one-x;
+ z = x*x;
+ r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
+ s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
+ y = r/s;
+ if(hx < 0x3e800000) { /* x<1/4 */
+ return one-(x+x*y);
+ } else {
+ r = x*y;
+ r += (x-half);
+ return half - r ;
+ }
+ }
+ if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */
+ s = fabsf(x)-one;
+ P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
+ Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
+ if(hx>=0) {
+ z = one-erx; return z - P/Q;
+ } else {
+ z = erx+P/Q; return one+z;
+ }
+ }
+ if (ix < 0x41e00000) { /* |x|<28 */
+ x = fabsf(x);
+ s = one/(x*x);
+ if(ix< 0x4036DB6D) { /* |x| < 1/.35 ~ 2.857143*/
+ R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
+ ra5+s*(ra6+s*ra7))))));
+ S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
+ sa5+s*(sa6+s*(sa7+s*sa8)))))));
+ } else { /* |x| >= 1/.35 ~ 2.857143 */
+ if(hx<0&&ix>=0x40c00000) return two-tiny;/* x < -6 */
+ R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
+ rb5+s*rb6)))));
+ S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
+ sb5+s*(sb6+s*sb7))))));
+ }
+ GET_FLOAT_WORD(ix,x);
+ SET_FLOAT_WORD(z,ix&0xffffe000);
+ r = __ieee754_expf(-z*z-(float)0.5625)*
+ __ieee754_expf((z-x)*(z+x)+R/S);
+ if(hx>0) {
+ float ret = math_narrow_eval (r/x);
+ if (ret == 0)
+ __set_errno (ERANGE);
+ return ret;
+ } else
+ return two-r/x;
+ } else {
+ if(hx>0) {
+ __set_errno (ERANGE);
+ return tiny*tiny;
+ } else
+ return two-tiny;
+ }
+}
+libm_alias_float (__erfc, erfc)
diff --git a/sysdeps/ieee754/flt-32/s_erff.c b/sysdeps/ieee754/flt-32/s_erff.c
index ba297342ea..6c541dba23 100644
--- a/sysdeps/ieee754/flt-32/s_erff.c
+++ b/sysdeps/ieee754/flt-32/s_erff.c
@@ -27,10 +27,7 @@ static char rcsid[] = "$NetBSD: s_erff.c,v 1.4 1995/05/10 20:47:07 jtc Exp $";
static const float
tiny = 1e-30,
-half= 5.0000000000e-01, /* 0x3F000000 */
one = 1.0000000000e+00, /* 0x3F800000 */
-two = 2.0000000000e+00, /* 0x40000000 */
- /* c = (subfloat)0.84506291151 */
erx = 8.4506291151e-01, /* 0x3f58560b */
/*
* Coefficients for approximation to erf on [0,0.84375]
@@ -156,77 +153,3 @@ float __erff(float x)
}
libm_alias_float (__erf, erf)
-float __erfcf(float x)
-{
- int32_t hx,ix;
- float R,S,P,Q,s,y,z,r;
- GET_FLOAT_WORD(hx,x);
- ix = hx&0x7fffffff;
- if(ix>=0x7f800000) { /* erfc(nan)=nan */
- /* erfc(+-inf)=0,2 */
- float ret = (float)(((uint32_t)hx>>31)<<1)+one/x;
- if (FIX_INT_FP_CONVERT_ZERO && ret == 0.0f)
- return 0.0f;
- return ret;
- }
-
- if(ix < 0x3f580000) { /* |x|<0.84375 */
- if(ix < 0x32800000) /* |x|<2**-26 */
- return one-x;
- z = x*x;
- r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
- s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
- y = r/s;
- if(hx < 0x3e800000) { /* x<1/4 */
- return one-(x+x*y);
- } else {
- r = x*y;
- r += (x-half);
- return half - r ;
- }
- }
- if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */
- s = fabsf(x)-one;
- P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
- Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
- if(hx>=0) {
- z = one-erx; return z - P/Q;
- } else {
- z = erx+P/Q; return one+z;
- }
- }
- if (ix < 0x41e00000) { /* |x|<28 */
- x = fabsf(x);
- s = one/(x*x);
- if(ix< 0x4036DB6D) { /* |x| < 1/.35 ~ 2.857143*/
- R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
- ra5+s*(ra6+s*ra7))))));
- S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
- sa5+s*(sa6+s*(sa7+s*sa8)))))));
- } else { /* |x| >= 1/.35 ~ 2.857143 */
- if(hx<0&&ix>=0x40c00000) return two-tiny;/* x < -6 */
- R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
- rb5+s*rb6)))));
- S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
- sb5+s*(sb6+s*sb7))))));
- }
- GET_FLOAT_WORD(ix,x);
- SET_FLOAT_WORD(z,ix&0xffffe000);
- r = __ieee754_expf(-z*z-(float)0.5625)*
- __ieee754_expf((z-x)*(z+x)+R/S);
- if(hx>0) {
- float ret = math_narrow_eval (r/x);
- if (ret == 0)
- __set_errno (ERANGE);
- return ret;
- } else
- return two-r/x;
- } else {
- if(hx>0) {
- __set_errno (ERANGE);
- return tiny*tiny;
- } else
- return two-tiny;
- }
-}
-libm_alias_float (__erfc, erfc)
diff --git a/sysdeps/ieee754/ldbl-128/s_erfcl.c b/sysdeps/ieee754/ldbl-128/s_erfcl.c
new file mode 100644
index 0000000000..95d17c8c28
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128/s_erfcl.c
@@ -0,0 +1 @@
+/* Not required. */
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_erfcl.c b/sysdeps/ieee754/ldbl-128ibm/s_erfcl.c
new file mode 100644
index 0000000000..95d17c8c28
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_erfcl.c
@@ -0,0 +1 @@
+/* Not required. */
diff --git a/sysdeps/ieee754/ldbl-96/s_erfcl.c b/sysdeps/ieee754/ldbl-96/s_erfcl.c
new file mode 100644
index 0000000000..95d17c8c28
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-96/s_erfcl.c
@@ -0,0 +1 @@
+/* Not required. */
--
2.43.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 08/11] math: Use erff from CORE-MATH
2024-11-11 13:45 [PATCH 00/11] Add more CORE-math implementations to libm Adhemerval Zanella
` (6 preceding siblings ...)
2024-11-11 13:45 ` [PATCH 07/11] math: Split s_erfF in erff and erfc Adhemerval Zanella
@ 2024-11-11 13:45 ` Adhemerval Zanella
2024-11-20 23:10 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 09/11] math: Use erfcf " Adhemerval Zanella
` (2 subsequent siblings)
10 siblings, 1 reply; 34+ messages in thread
From: Adhemerval Zanella @ 2024-11-11 13:45 UTC (permalink / raw)
To: libc-alpha; +Cc: Alexei Sibidanov, Paul Zimmermann
The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance to the generic erff.
The code was adapted to glibc style and to use the definition of
math_config.h.
Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (M1,
gcc 13.2.1), and powerpc (POWER10, gcc 13.2.1):
latency master patched improvement
x86_64 85.7363 45.1372 47.35%
x86_64v2 86.6337 38.5816 55.47%
x86_64v3 71.3810 34.0843 52.25%
i686 190.143 97.5014 48.72%
aarch64 34.9091 14.9320 57.23%
power10 38.6160 8.5188 77.94%
powerpc 39.7446 8.45781 78.72%
reciprocal-throughput master patched improvement
x86_64 35.1739 14.7603 58.04%
x86_64v2 34.5976 11.2283 67.55%
x86_64v3 27.3260 9.8550 63.94%
i686 91.0282 30.8840 66.07%
aarch64 22.5831 6.9615 69.17%
power10 18.0386 3.0918 82.86%
powerpc 20.7277 3.63396 82.47%
Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
---
SHARED-FILES | 4 +
sysdeps/aarch64/libm-test-ulps | 1 -
sysdeps/alpha/fpu/libm-test-ulps | 4 -
sysdeps/arc/fpu/libm-test-ulps | 4 -
sysdeps/arc/nofpu/libm-test-ulps | 1 -
sysdeps/arm/libm-test-ulps | 4 -
sysdeps/csky/fpu/libm-test-ulps | 4 -
sysdeps/csky/nofpu/libm-test-ulps | 4 -
sysdeps/hppa/fpu/libm-test-ulps | 4 -
sysdeps/i386/fpu/libm-test-ulps | 4 -
.../i386/i686/fpu/multiarch/libm-test-ulps | 4 -
sysdeps/ieee754/flt-32/s_erff.c | 393 +++++++++++-------
sysdeps/loongarch/lp64/libm-test-ulps | 4 -
sysdeps/m68k/m680x0/fpu/libm-test-ulps | 4 -
sysdeps/microblaze/libm-test-ulps | 1 -
sysdeps/mips/mips32/libm-test-ulps | 4 -
sysdeps/mips/mips64/libm-test-ulps | 4 -
sysdeps/nios2/libm-test-ulps | 1 -
sysdeps/or1k/fpu/libm-test-ulps | 4 -
sysdeps/or1k/nofpu/libm-test-ulps | 4 -
sysdeps/powerpc/fpu/libm-test-ulps | 4 -
sysdeps/powerpc/nofpu/libm-test-ulps | 4 -
sysdeps/riscv/nofpu/libm-test-ulps | 4 -
sysdeps/riscv/rvd/libm-test-ulps | 4 -
sysdeps/s390/fpu/libm-test-ulps | 4 -
sysdeps/sh/libm-test-ulps | 2 -
sysdeps/sparc/fpu/libm-test-ulps | 4 -
sysdeps/x86_64/fpu/libm-test-ulps | 4 -
28 files changed, 251 insertions(+), 236 deletions(-)
diff --git a/SHARED-FILES b/SHARED-FILES
index d367f4b62f..ccc5179f80 100644
--- a/SHARED-FILES
+++ b/SHARED-FILES
@@ -272,3 +272,7 @@ sysdeps/ieee754/flt-32/s_cbrtf.c
(file src/binary32/cbrt/cbrtf.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
+sysdeps/ieee754/flt-32/s_erff.c
+ (file src/binary32/erf/erff.c in CORE-MATH)
+ - The code was adapted to use glibc code style and internal
+ functions to handle errno, overflow, and underflow.
diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulps
index 4979769b58..fc10f7f80d 100644
--- a/sysdeps/aarch64/libm-test-ulps
+++ b/sysdeps/aarch64/libm-test-ulps
@@ -991,7 +991,6 @@ ldouble: 5
Function: "erf":
double: 1
-float: 1
ldouble: 1
Function: "erf_advsimd":
diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
index a2b5404f9d..bbb3a5c459 100644
--- a/sysdeps/alpha/fpu/libm-test-ulps
+++ b/sysdeps/alpha/fpu/libm-test-ulps
@@ -909,22 +909,18 @@ ldouble: 5
Function: "erf":
double: 1
-float: 1
ldouble: 1
Function: "erf_downward":
double: 1
-float: 1
ldouble: 2
Function: "erf_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "erf_upward":
double: 1
-float: 1
ldouble: 2
Function: "erfc":
diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
index c6f3646797..9e422da289 100644
--- a/sysdeps/arc/fpu/libm-test-ulps
+++ b/sysdeps/arc/fpu/libm-test-ulps
@@ -733,19 +733,15 @@ float: 6
Function: "erf":
double: 1
-float: 1
Function: "erf_downward":
double: 1
-float: 1
Function: "erf_towardzero":
double: 1
-float: 2
Function: "erf_upward":
double: 2
-float: 2
Function: "erfc":
double: 5
diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps
index 6319012db5..2c24fdf663 100644
--- a/sysdeps/arc/nofpu/libm-test-ulps
+++ b/sysdeps/arc/nofpu/libm-test-ulps
@@ -177,7 +177,6 @@ float: 2
Function: "erf":
double: 1
-float: 1
Function: "erfc":
double: 5
diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
index d9317046a9..153cd1f3d7 100644
--- a/sysdeps/arm/libm-test-ulps
+++ b/sysdeps/arm/libm-test-ulps
@@ -726,19 +726,15 @@ float: 3
Function: "erf":
double: 1
-float: 1
Function: "erf_downward":
double: 1
-float: 1
Function: "erf_towardzero":
double: 1
-float: 1
Function: "erf_upward":
double: 1
-float: 1
Function: "erfc":
double: 5
diff --git a/sysdeps/csky/fpu/libm-test-ulps b/sysdeps/csky/fpu/libm-test-ulps
index c3a3db9bcb..d276db245b 100644
--- a/sysdeps/csky/fpu/libm-test-ulps
+++ b/sysdeps/csky/fpu/libm-test-ulps
@@ -719,19 +719,15 @@ float: 3
Function: "erf":
double: 1
-float: 1
Function: "erf_downward":
double: 1
-float: 1
Function: "erf_towardzero":
double: 1
-float: 1
Function: "erf_upward":
double: 1
-float: 1
Function: "erfc":
double: 5
diff --git a/sysdeps/csky/nofpu/libm-test-ulps b/sysdeps/csky/nofpu/libm-test-ulps
index 68a74bf1d0..ea08fd5378 100644
--- a/sysdeps/csky/nofpu/libm-test-ulps
+++ b/sysdeps/csky/nofpu/libm-test-ulps
@@ -717,19 +717,15 @@ float: 3
Function: "erf":
double: 1
-float: 1
Function: "erf_downward":
double: 1
-float: 1
Function: "erf_towardzero":
double: 1
-float: 1
Function: "erf_upward":
double: 1
-float: 1
Function: "erfc":
double: 5
diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
index a54737db2e..7e4f6ebe77 100644
--- a/sysdeps/hppa/fpu/libm-test-ulps
+++ b/sysdeps/hppa/fpu/libm-test-ulps
@@ -739,20 +739,16 @@ float: 3
Function: "erf":
double: 1
-float: 1
ldouble: 1
Function: "erf_downward":
double: 1
-float: 1
Function: "erf_towardzero":
double: 1
-float: 1
Function: "erf_upward":
double: 1
-float: 1
Function: "erfc":
double: 5
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index a77ded2648..041c180f7a 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -1078,25 +1078,21 @@ ldouble: 3
Function: "erf":
double: 1
-float: 1
float128: 1
ldouble: 1
Function: "erf_downward":
double: 1
-float: 1
float128: 2
ldouble: 1
Function: "erf_towardzero":
double: 1
-float: 1
float128: 1
ldouble: 1
Function: "erf_upward":
double: 1
-float: 1
float128: 2
ldouble: 1
diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
index a9cd01bf03..e3ee0c61f6 100644
--- a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
+++ b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
@@ -1081,25 +1081,21 @@ ldouble: 3
Function: "erf":
double: 1
-float: 1
float128: 1
ldouble: 1
Function: "erf_downward":
double: 1
-float: 1
float128: 2
ldouble: 1
Function: "erf_towardzero":
double: 1
-float: 1
float128: 1
ldouble: 1
Function: "erf_upward":
double: 1
-float: 1
float128: 2
ldouble: 1
diff --git a/sysdeps/ieee754/flt-32/s_erff.c b/sysdeps/ieee754/flt-32/s_erff.c
index 6c541dba23..762f160e9f 100644
--- a/sysdeps/ieee754/flt-32/s_erff.c
+++ b/sysdeps/ieee754/flt-32/s_erff.c
@@ -1,155 +1,256 @@
-/* s_erff.c -- float version of s_erf.c.
- */
+/* Correctly-rounded error function for binary32 value.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+Copyright (c) 2022-2024 Alexei Sibidanov.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_erff.c,v 1.4 1995/05/10 20:47:07 jtc Exp $";
-#endif
+This file is part of the CORE-MATH project
+project (file src/binary32/erf/erff.c revision bc385c2).
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
-#include <errno.h>
-#include <float.h>
#include <math.h>
-#include <math-narrow-eval.h>
-#include <math_private.h>
-#include <math-underflow.h>
+#include <stdint.h>
#include <libm-alias-float.h>
-#include <fix-int-fp-convert-zero.h>
+#include "math_config.h"
-static const float
-tiny = 1e-30,
-one = 1.0000000000e+00, /* 0x3F800000 */
-erx = 8.4506291151e-01, /* 0x3f58560b */
-/*
- * Coefficients for approximation to erf on [0,0.84375]
- */
-efx = 1.2837916613e-01, /* 0x3e0375d4 */
-pp0 = 1.2837916613e-01, /* 0x3e0375d4 */
-pp1 = -3.2504209876e-01, /* 0xbea66beb */
-pp2 = -2.8481749818e-02, /* 0xbce9528f */
-pp3 = -5.7702702470e-03, /* 0xbbbd1489 */
-pp4 = -2.3763017452e-05, /* 0xb7c756b1 */
-qq1 = 3.9791721106e-01, /* 0x3ecbbbce */
-qq2 = 6.5022252500e-02, /* 0x3d852a63 */
-qq3 = 5.0813062117e-03, /* 0x3ba68116 */
-qq4 = 1.3249473704e-04, /* 0x390aee49 */
-qq5 = -3.9602282413e-06, /* 0xb684e21a */
-/*
- * Coefficients for approximation to erf in [0.84375,1.25]
- */
-pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */
-pa1 = 4.1485610604e-01, /* 0x3ed46805 */
-pa2 = -3.7220788002e-01, /* 0xbebe9208 */
-pa3 = 3.1834661961e-01, /* 0x3ea2fe54 */
-pa4 = -1.1089469492e-01, /* 0xbde31cc2 */
-pa5 = 3.5478305072e-02, /* 0x3d1151b3 */
-pa6 = -2.1663755178e-03, /* 0xbb0df9c0 */
-qa1 = 1.0642088205e-01, /* 0x3dd9f331 */
-qa2 = 5.4039794207e-01, /* 0x3f0a5785 */
-qa3 = 7.1828655899e-02, /* 0x3d931ae7 */
-qa4 = 1.2617121637e-01, /* 0x3e013307 */
-qa5 = 1.3637083583e-02, /* 0x3c5f6e13 */
-qa6 = 1.1984500103e-02, /* 0x3c445aa3 */
-/*
- * Coefficients for approximation to erfc in [1.25,1/0.35]
- */
-ra0 = -9.8649440333e-03, /* 0xbc21a093 */
-ra1 = -6.9385856390e-01, /* 0xbf31a0b7 */
-ra2 = -1.0558626175e+01, /* 0xc128f022 */
-ra3 = -6.2375331879e+01, /* 0xc2798057 */
-ra4 = -1.6239666748e+02, /* 0xc322658c */
-ra5 = -1.8460508728e+02, /* 0xc3389ae7 */
-ra6 = -8.1287437439e+01, /* 0xc2a2932b */
-ra7 = -9.8143291473e+00, /* 0xc11d077e */
-sa1 = 1.9651271820e+01, /* 0x419d35ce */
-sa2 = 1.3765776062e+02, /* 0x4309a863 */
-sa3 = 4.3456588745e+02, /* 0x43d9486f */
-sa4 = 6.4538726807e+02, /* 0x442158c9 */
-sa5 = 4.2900814819e+02, /* 0x43d6810b */
-sa6 = 1.0863500214e+02, /* 0x42d9451f */
-sa7 = 6.5702495575e+00, /* 0x40d23f7c */
-sa8 = -6.0424413532e-02, /* 0xbd777f97 */
-/*
- * Coefficients for approximation to erfc in [1/.35,28]
- */
-rb0 = -9.8649431020e-03, /* 0xbc21a092 */
-rb1 = -7.9928326607e-01, /* 0xbf4c9dd4 */
-rb2 = -1.7757955551e+01, /* 0xc18e104b */
-rb3 = -1.6063638306e+02, /* 0xc320a2ea */
-rb4 = -6.3756646729e+02, /* 0xc41f6441 */
-rb5 = -1.0250950928e+03, /* 0xc480230b */
-rb6 = -4.8351919556e+02, /* 0xc3f1c275 */
-sb1 = 3.0338060379e+01, /* 0x41f2b459 */
-sb2 = 3.2579251099e+02, /* 0x43a2e571 */
-sb3 = 1.5367296143e+03, /* 0x44c01759 */
-sb4 = 3.1998581543e+03, /* 0x4547fdbb */
-sb5 = 2.5530502930e+03, /* 0x451f90ce */
-sb6 = 4.7452853394e+02, /* 0x43ed43a7 */
-sb7 = -2.2440952301e+01; /* 0xc1b38712 */
-
-float __erff(float x)
+float
+__erff (float x)
{
- int32_t hx,ix,i;
- float R,S,P,Q,s,y,z,r;
- GET_FLOAT_WORD(hx,x);
- ix = hx&0x7fffffff;
- if(ix>=0x7f800000) { /* erf(nan)=nan */
- i = ((uint32_t)hx>>31)<<1;
- return (float)(1-i)+one/x; /* erf(+-inf)=+-1 */
- }
-
- if(ix < 0x3f580000) { /* |x|<0.84375 */
- if(ix < 0x31800000) { /* |x|<2**-28 */
- if (ix < 0x04000000)
- {
- /* Avoid spurious underflow. */
- float ret = 0.0625f * (16.0f * x + (16.0f * efx) * x);
- math_check_force_underflow (ret);
- return ret;
- }
- return x + efx*x;
- }
- z = x*x;
- r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
- s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
- y = r/s;
- return x + x*y;
- }
- if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */
- s = fabsf(x)-one;
- P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
- Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
- if(hx>=0) return erx + P/Q; else return -erx - P/Q;
- }
- if (ix >= 0x40c00000) { /* inf>|x|>=6 */
- if(hx>=0) return one-tiny; else return tiny-one;
- }
- x = fabsf(x);
- s = one/(x*x);
- if(ix< 0x4036DB6E) { /* |x| < 1/0.35 */
- R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
- ra5+s*(ra6+s*ra7))))));
- S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
- sa5+s*(sa6+s*(sa7+s*sa8)))))));
- } else { /* |x| >= 1/0.35 */
- R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
- rb5+s*rb6)))));
- S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
- sb5+s*(sb6+s*sb7))))));
- }
- GET_FLOAT_WORD(ix,x);
- SET_FLOAT_WORD(z,ix&0xfffff000);
- r = __ieee754_expf(-z*z-(float)0.5625)*__ieee754_expf((z-x)*(z+x)+R/S);
- if(hx>=0) return one-r/x; else return r/x-one;
+ /* for 7 <= i < 63, C[i-7] is a degree-7 polynomial approximation of
+ erf(i/16+1/32+x) for -1/32 <= x <= 1/32 */
+ static const double C[56][8] = {
+ { 0x1.f86faa9428f9cp-2, 0x1.cfc41e36c7dfap-1, -0x1.b2c7dc53508b9p-2,
+ -0x1.5a9de93fa556ep-3, 0x1.731793dbb01b5p-3, 0x1.133e06426cf18p-6,
+ -0x1.a12a6289cafd8p-5, 0x1.717d6f1d6f557p-9 },
+ { 0x1.1855a5fd3dd50p-1, 0x1.b3aafcc27502fp-1, -0x1.cee5ac8e92bb2p-2,
+ -0x1.fa02983ca2d79p-4, 0x1.77cd746cb1922p-3, -0x1.fa6f277886487p-10,
+ -0x1.8de75458db416p-5, 0x1.00899c98551c9p-7 },
+ { 0x1.32a54cb8db67ap-1, 0x1.96164fafd8de5p-1, -0x1.e23a7ea0c9ad3p-2,
+ -0x1.3f5ee15671cf4p-4, 0x1.70e468a3d72d9p-3, -0x1.3da68037cfc99p-6,
+ -0x1.69ed9ba1f9839p-5, 0x1.8cab9244a4ff4p-7 },
+ { 0x1.4b13713ad3513p-1, 0x1.7791b886e7405p-1, -0x1.ecef423109bf5p-2,
+ -0x1.15c3c5cec6847p-5, 0x1.5f688fc931ba6p-3, -0x1.1da63ed190037p-5,
+ -0x1.38427ca63cca4p-5, 0x1.fa00e52525e17p-7 },
+ { 0x1.61955607dd15dp-1, 0x1.58a445da7c74ep-1, -0x1.ef6c246a0f66cp-2,
+ 0x1.e83e0d9d61330p-8, 0x1.44cc65535bc9fp-3, -0x1.87d3c4860435dp-5,
+ -0x1.f90b10501169bp-6, 0x1.22295856d427ap-6 },
+ { 0x1.762870f720c6fp-1, 0x1.39ccc1b136d5cp-1, -0x1.ea4feea4e4744p-2,
+ 0x1.715e5952ebfbap-5, 0x1.22cdbd83c75c4p-3, -0x1.da50aa1d925b6p-5,
+ -0x1.754dc0a29b4ddp-6, 0x1.350b6bef9392cp-6 },
+ { 0x1.88d1cd474a2e0p-1, 0x1.1b7e98fe26219p-1, -0x1.de65a22ce1419p-2,
+ 0x1.40686a3f16400p-4, 0x1.f6b0cbb216b2bp-4, -0x1.09c7c903edd57p-4,
+ -0x1.da7529fde641p-7, 0x1.362a7a0588eabp-6 },
+ { 0x1.999d4192a5717p-1, 0x1.fc3ee5d1524b3p-2, -0x1.cc990045b55c8p-2,
+ 0x1.b37338e68b37dp-4, 0x1.a0d120c872ea7p-4, -0x1.19bb2b07ecff6p-4,
+ -0x1.a110f5f593aafp-8, 0x1.272c15a57720ep-6 },
+ { 0x1.a89c850b7d54dp-1, 0x1.c40b0729ed54ap-2, -0x1.b5eaaef0a2346p-2,
+ 0x1.0847c7dacbae1p-3, 0x1.47de0ba6d18fbp-4, -0x1.1d9de77a4b648p-4,
+ 0x1.30ffbe56f0726p-10, 0x1.0a9cb99feea01p-6 },
+ { 0x1.b5e62fce16096p-1, 0x1.8eed36b886d95p-2, -0x1.9b64a06e50705p-2,
+ 0x1.2bb6e2c744df5p-3, 0x1.dee3261ca61bcp-5, -0x1.16996004f7da5p-4,
+ 0x1.fdff37bae983ep-8, 0x1.c750083e65f9ap-7 },
+ { 0x1.c194b1d49a184p-1, 0x1.5d4fd33729015p-2, -0x1.7e0f4f045addbp-2,
+ 0x1.444bc66c31a1bp-3, 0x1.356dbf16ec8f1p-5, -0x1.0643de0906cd8p-4,
+ 0x1.b281af7bd3a2cp-7, 0x1.6b97eaa2c6abdp-7 },
+ { 0x1.cbc54b476248ep-1, 0x1.2f7cc3fe6f423p-2, -0x1.5ee8429e36de8p-2,
+ 0x1.52a8395f96177p-3, 0x1.313761ba257dcp-6, -0x1.dcf844d5fed8fp-5,
+ 0x1.1e1420f475fa9p-6, 0x1.091c7dc1e18b2p-7 },
+ { 0x1.d4970f9ce00d9p-1, 0x1.059f59af7a905p-2, -0x1.3eda354de36c3p-2,
+ 0x1.57b85ad439779p-3, 0x1.8e913b9778136p-10, -0x1.a2893bd3435f4p-5,
+ 0x1.4d3a90e37164ap-6, 0x1.4ce7f6e19a902p-8 },
+ { 0x1.dc29fb60715b0p-1, 0x1.bf8e1b1ca2277p-3, -0x1.1eb7095e5d6d2p-2,
+ 0x1.549ea6f7a64f4p-3, -0x1.b10f12f3877a3p-7, -0x1.61420c8f7156ap-5,
+ 0x1.674f1f92a8812p-6, 0x1.25543ffd74d52p-9 },
+ { 0x1.e29e22a89d767p-1, 0x1.7bd5c7df3fe99p-3, -0x1.fe674494077bfp-3,
+ 0x1.4a9feacf86578p-3, -0x1.a008269076644p-6, -0x1.1cf0e8fb4f1cbp-5,
+ 0x1.6e0d2ef105fb3p-6, -0x1.367205fbd7876p-12 },
+ { 0x1.e812fc64db36ap-1, 0x1.3fda6bc016991p-3, -0x1.c1cb278627920p-3,
+ 0x1.3b10512314f1ep-3, -0x1.1e6457bb1b9a9p-5, -0x1.b1f6474e2388cp-6,
+ 0x1.640a5345f7ec7p-6, -0x1.3dae5a997fdbp-9 },
+ { 0x1.eca6ccd709544p-1, 0x1.0b3f52ce8c380p-3, -0x1.8885019f63c6dp-3,
+ 0x1.274275fc91a05p-3, -0x1.57f73699a8372p-5, -0x1.3076a305fc7cep-6,
+ 0x1.4c6ae04843a41p-6, -0x1.0be5fcf5ecc91p-8 },
+ { 0x1.f0762fde45ee7p-1, 0x1.bb1c972f23e4ap-4, -0x1.5341e3c01b58dp-3,
+ 0x1.107929f6f0b60p-3, -0x1.7e1b34f976c02p-5, -0x1.73b62589c234ap-7,
+ 0x1.2a97ee1876486p-6, -0x1.595f40a3150fep-8 },
+ { 0x1.f39bc242e43e6p-1, 0x1.6c7e64e7281c5p-4, -0x1.2274b86835fd3p-3,
+ 0x1.efb890e5c770dp-4, -0x1.92c7db16847e0p-5, -0x1.45477db5e2dd4p-8,
+ 0x1.01fc6165fc866p-6, -0x1.8845509030c2cp-8 },
+ { 0x1.f62fe80272419p-1, 0x1.297db960e4f5dp-4, -0x1.ecb83b087c04fp-4,
+ 0x1.bce18363ca3d1p-4, -0x1.985aaf776482cp-5, 0x1.cd953efdae886p-12,
+ 0x1.ab9a0b89b54ffp-7, -0x1.9b5e576ccc31cp-8 },
+ { 0x1.f848acb544e95p-1, 0x1.e1d4cf1e24501p-5, -0x1.9e12e1fde5552p-4,
+ 0x1.8a27806df3d1bp-4, -0x1.91674e5eb3319p-5, 0x1.3bc75595b2db8p-8,
+ 0x1.51bc537ac61afp-7, -0x1.96b23b19ea04dp-8 },
+ { 0x1.f9f9ba8d3c733p-1, 0x1.83298d7172108p-5, -0x1.58d101f905a75p-4,
+ 0x1.58f1456f8639bp-4, -0x1.808d1850b8231p-5, 0x1.0c1bd99c348a7p-7,
+ 0x1.f61e9d7bc48cap-8, -0x1.7f07c13441774p-8 },
+ { 0x1.fb54641aebbc9p-1, 0x1.34ac36ad8dafap-5, -0x1.1c8ec267f9405p-4,
+ 0x1.2a52c5d841848p-4, -0x1.68541c02b3b6bp-5, 0x1.5afe400196379p-7,
+ 0x1.565b2d6eda3d6p-8, -0x1.596aaff29e739p-8 },
+ { 0x1.fc67bcf2d7b8fp-1, 0x1.e85c449e377efp-6, -0x1.d177f166c07c6p-5,
+ 0x1.fe23b7584b504p-5, -0x1.4b12109613313p-5, 0x1.8d9905c0acf7dp-7,
+ 0x1.9265032a669dap-9, -0x1.2ac4a6dbcbf3ep-8 },
+ { 0x1.fd40bd6d7a785p-1, 0x1.7f5188610ddc7p-6, -0x1.7954423f7c998p-5,
+ 0x1.af5baae33887fp-5, -0x1.2ad77c7cbc474p-5, 0x1.a7b8c47ec2a51p-7,
+ 0x1.46646ee094bccp-10, -0x1.ef19d8db8673p-9 },
+ { 0x1.fdea6e062d0c9p-1, 0x1.2a875b5ffab58p-6, -0x1.2f3178cd6dcd5p-5,
+ 0x1.68d1c45b94182p-5, -0x1.09648ed3aeaefp-5, 0x1.ad8b150d38164p-7,
+ -0x1.e9a6023d9429fp-13, -0x1.8722d19ee2e8ep-9 },
+ { 0x1.fe6e1742f7cf5p-1, 0x1.cd5ec93c1243ap-7, -0x1.e2ff3aaacb386p-6,
+ 0x1.2aa4e5823cc89p-5, -0x1.d049842dbe399p-6, 0x1.a34edb21ab302p-7,
+ -0x1.676e5996c7f9bp-10, -0x1.23b01a35140bfp-9 },
+ { 0x1.fed37386190fbp-1, 0x1.61beae53b72c2p-7, -0x1.7d6193f22c3c1p-6,
+ 0x1.e947279e3bb7dp-6, -0x1.906031b97ca97p-6, 0x1.8d14d62561755p-7,
+ -0x1.1f245e7178882p-9, -0x1.9257d4eb47685p-10 },
+ { 0x1.ff20e0a7ba8c2p-1, 0x1.0d1d69569b839p-7, -0x1.2a8ca0dc02752p-6,
+ 0x1.8cc071b709751p-6, -0x1.54a149f1b070cp-6, 0x1.6e9137b13412cp-7,
+ -0x1.6577ed3d8e83bp-9, -0x1.e9c1a5178a289p-11 },
+ { 0x1.ff5b8fb26f5f6p-1, 0x1.9646f35a7663cp-8, -0x1.cf68ed9311b0bp-7,
+ 0x1.3e8735b5a694fp-6, -0x1.1e1612d026fdfp-6, 0x1.4afd8e6ca636dp-7,
+ -0x1.8c375170ccb22p-9, -0x1.c799443c4fd3bp-12 },
+ { 0x1.ff87b1913e853p-1, 0x1.30499b5039596p-8, -0x1.64964201ec8bap-7,
+ 0x1.fa73d7eafba98p-7, -0x1.daa3022141fbbp-7, 0x1.2509444c063b7p-7,
+ -0x1.99482a2f8a0a1p-9, -0x1.403d1f76c9454p-15 },
+ { 0x1.ffa89fe5b3625p-1, 0x1.c4412bf4b8f35p-9, -0x1.100f347126cf0p-7,
+ 0x1.8ebda07671d40p-7, -0x1.850c6a31c98c1p-7, 0x1.fdac860c67d21p-8,
+ -0x1.927d03d2ba12cp-9, 0x1.0ff620b4190fep-12 },
+ { 0x1.ffc10194fcb64p-1, 0x1.4d78bba8ca621p-9, -0x1.9ba107a443e02p-8,
+ 0x1.36f273fbc04ccp-7, -0x1.3b38716ac7e6fp-7, 0x1.b3fe0181914acp-8,
+ -0x1.7d3fe7de98c5cp-9, 0x1.ea31f8e5317f7p-12 },
+ { 0x1.ffd2eae369a07p-1, 0x1.e7f232d9e266cp-10, -0x1.34c7442dd48d9p-8,
+ 0x1.e066bed070a0bp-8, -0x1.f914f3c42fc0dp-8, 0x1.6f4664ed2260fp-8,
+ -0x1.5e59910761d24p-9, 0x1.39cbb6e84c126p-11 },
+ { 0x1.ffdff92db56e5p-1, 0x1.6235fbd7a4373p-10, -0x1.cb5e029b9e56ap-9,
+ 0x1.6fa4c7ef274dap-8, -0x1.903a089a835f3p-8, 0x1.30f12e0ca1901p-8,
+ -0x1.39d21b6957f99p-9, 0x1.5d3f8495a703cp-11 },
+ { 0x1.ffe96a78a04a9p-1, 0x1.fe41cd9bb4f2cp-11, -0x1.52d7b28966c0cp-9,
+ 0x1.16c192d86a1a7p-8, -0x1.39bfce951100cp-8, 0x1.f376a7869f9e3p-9,
+ -0x1.12e6cef999c4fp-9, 0x1.66acd4d667b5p-11 },
+ { 0x1.fff0312b010b5p-1, 0x1.6caa0d3583018p-11, -0x1.efb729f4cf75bp-10,
+ 0x1.a2da7cebe12acp-9, -0x1.e6c27a24bc759p-9, 0x1.93b1f4d8ea65p-9,
+ -0x1.d82050aa94a08p-10, 0x1.5cd7dc75d6cbap-11 },
+ { 0x1.fff50456dab8cp-1, 0x1.0295ef6591865p-11, -0x1.679880e95a4dap-10,
+ 0x1.37d38e3a5c8ebp-9, -0x1.75b3708aebb8fp-9, 0x1.4231c4b4b0296p-9,
+ -0x1.8e26476489318p-10, 0x1.45c3b570dd924p-11 },
+ { 0x1.fff86cfd3e657p-1, 0x1.6be02102b353dp-12, -0x1.02b157780d6aep-10,
+ 0x1.cc1d886861133p-10, -0x1.1bff6f12ec9abp-9, 0x1.fc0f77bd9c736p-10,
+ -0x1.4a3320bd0959dp-10, 0x1.267f8b4f95d2p-11 },
+ { 0x1.fffad0b901755p-1, 0x1.fc0d55470cf5ep-13, -0x1.7121aff5e820ep-11,
+ 0x1.506d6992f7de5p-10, -0x1.ab595d3ecd0d6p-10, 0x1.8bdd79daaf754p-10,
+ -0x1.0d9b090f997c1p-10, 0x1.031ab9fd1c7dap-11 },
+ { 0x1.fffc7a37857d2p-1, 0x1.5feada379d8a5p-13, -0x1.05304df58f3aap-11,
+ 0x1.e79c081b8600fp-11, -0x1.3e5dbe33232e0p-10, 0x1.30eb208200729p-10,
+ -0x1.b1d493b147945p-11, 0x1.bd587bbc071bep-12 },
+ { 0x1.fffd9fdeabccep-1, 0x1.e3bcf436a1a49p-14, -0x1.6e953111ef0a1p-12,
+ 0x1.5e3edf6768654p-11, -0x1.d5be67c0547a4p-11, 0x1.d07d9ffa1d435p-11,
+ -0x1.58328f5f358cap-11, 0x1.76d42d95c42c4p-12 },
+ { 0x1.fffe68f4fa777p-1, 0x1.49e17724f4cddp-14, -0x1.fe48c44e229c1p-13,
+ 0x1.f2bd95d76f188p-12, -0x1.57388cb12d011p-11, 0x1.5decc25c5c079p-11,
+ -0x1.0d7499d1b0d2dp-11, 0x1.359332c94ecdcp-12 },
+ { 0x1.fffef1960d85dp-1, 0x1.be6abbb10a4cdp-15, -0x1.6040381a8c313p-13,
+ 0x1.5fff1dde9ee9dp-12, -0x1.f0c933efa9971p-12, 0x1.04cbf4a5cd760p-11,
+ -0x1.a07f150af6dadp-12, 0x1.f68dd183426bap-13 },
+ { 0x1.ffff4db27f146p-1, 0x1.2bb5cc22e5cd8p-15, -0x1.e25894899f526p-14,
+ 0x1.ec8a8e5a72757p-13, -0x1.64256ae0a3cf9p-12, 0x1.80a836c18c46cp-12,
+ -0x1.3dea401af6775p-12, 0x1.915ddff3fe0d1p-13 },
+ { 0x1.ffff8b500e77cp-1, 0x1.8f4ccca7fc769p-16, -0x1.478cffe305946p-14,
+ 0x1.559f04adde504p-13, -0x1.f9e1577d6961dp-13, 0x1.18bda53c14716p-12,
+ -0x1.df8634c35541cp-13, 0x1.3bb5c6b616337p-13 },
+ { 0x1.ffffb43555b5fp-1, 0x1.07ebd2a2d26c8p-16, -0x1.b93e442a37f2bp-15,
+ 0x1.d5cf15159ce28p-14, -0x1.63f5e1469c006p-13, 0x1.95a03acebac18p-13,
+ -0x1.656e5e2a1f8e2p-13, 0x1.e98c437189bdep-14 },
+ { 0x1.ffffcf23ff5fcp-1, 0x1.5a2adfa0b492cp-17, -0x1.26c88270759f0p-15,
+ 0x1.40473572b99a8p-14, -0x1.f057cbde578a5p-14, 0x1.22178d1c3c948p-13,
+ -0x1.0765b61a0d859p-13, 0x1.765b3ea03ddbep-14 },
+ { 0x1.ffffe0bd3e852p-1, 0x1.c282cd3957a72p-18, -0x1.86ad6dfa44faap-16,
+ 0x1.b0f313f03a029p-15, -0x1.56e44abecd255p-14, 0x1.9ad1ecfe34a89p-14,
+ -0x1.7fe4033478618p-14, 0x1.1a8184e049fbfp-14 },
+ { 0x1.ffffec2641a9ep-1, 0x1.22df29821407ep-18, -0x1.00c902a6cfd98p-16,
+ 0x1.22234eb88671fp-15, -0x1.d57a181c9e6e1p-15, 0x1.200c283b54a90p-14,
+ -0x1.14b4c3295a7d0p-14, 0x1.a4f966f713bdep-15 },
+ { 0x1.fffff37d63a36p-1, 0x1.74adc8f405eecp-19, -0x1.4ed4228e44858p-17,
+ 0x1.81918baea92bap-16, -0x1.3e81b17a0009cp-15, 0x1.9004a36116436p-15,
+ -0x1.8aa1ba400e076p-15, 0x1.35cd4e2340a9ep-15 },
+ { 0x1.fffff82cdcf1bp-1, 0x1.d9c73698fa87dp-20, -0x1.b11017ec67115p-18,
+ 0x1.fc0dfadf653f8p-17, -0x1.ac4e03cd2dfc2p-16, 0x1.131806b5abbc5p-15,
+ -0x1.1672ef66fcaafp-15, 0x1.c2882c7debed7p-16 },
+ { 0x1.fffffb248c39dp-1, 0x1.2acee2f5ec66ap-20, -0x1.15cc570408a36p-18,
+ 0x1.4be757bbb75a3p-17, -0x1.1d6aa5f8d2940p-16, 0x1.76c5937d5105ep-16,
+ -0x1.84dffc3ca9302p-16, 0x1.43c8315f2c30ap-16 },
+ { 0x1.fffffd01f36afp-1, 0x1.75fa8dbc840bap-21, -0x1.6186da0133f5ap-19,
+ 0x1.ae023231e1af5p-18, -0x1.790812f7ca394p-17, 0x1.f9c25656d0ef2p-17,
+ -0x1.0cc66682e304cp-16, 0x1.cc170a75d6f9cp-17 },
+ { 0x1.fffffe2ba0ea5p-1, 0x1.d06ad6ecde88ep-22, -0x1.be46aa8edc9a1p-20,
+ 0x1.143860c7840b8p-18, -0x1.edaba78fb1260p-18, 0x1.52138a96ecee2p-17,
+ -0x1.6fca538c4e2eep-17, 0x1.434040640bcefp-17 },
+ { 0x1.fffffee3cc32cp-1, 0x1.1e1e857adb8ddp-22, -0x1.1769ce5f2a6e8p-20,
+ 0x1.5fe5d479b0543p-19, -0x1.405d865c94c2ap-18, 0x1.bfc94feb96afcp-18,
+ -0x1.f245d5f3e8358p-18, 0x1.c142456acf443p-18 },
+ };
+ float ax = fabsf (x);
+ uint32_t ux = asuint (ax);
+ double s = x;
+ double z = ax;
+ /* 0x407ad444 corresponds to x = 0x1.f5a888p+1 = 3.91921..., which is the
+ largest float such that erf(x) does not round to 1 (to nearest). */
+ if (__glibc_unlikely (ux > 0x407ad444u))
+ {
+ float os = copysignf (1.0f, x);
+ if (ux > (0xffu << 23))
+ return x + x; /* nan */
+ if (ux == (0xffu << 23))
+ return os; /* +-inf */
+ return os - 0x1p-25f * os;
+ }
+ double v = floor (16.0 * z);
+ uint32_t i = 16.0f * ax;
+ /* 0x3ee00000 corresponds to x = 0.4375, for smaller x we have i < 7. */
+ if (__glibc_unlikely (ux < 0x3ee00000u))
+ {
+ static const double c[] =
+ {
+ 0x1.20dd750429b6dp+0, -0x1.812746b0375fbp-2,
+ 0x1.ce2f219fd6f45p-4, -0x1.b82ce2cbf0838p-6,
+ 0x1.565bb655adb85p-8, -0x1.c025bfc879c94p-11,
+ 0x1.f81718f61309cp-14, -0x1.cc67bd88f5867p-17
+ };
+ double z2 = s * s, z4 = z2 * z2, z8 = z4 * z4;
+ double c0 = c[0] + z2 * c[1];
+ double c2 = c[2] + z2 * c[3];
+ double c4 = c[4] + z2 * c[5];
+ double c6 = c[6] + z2 * c[7];
+ c0 += z4 * c2;
+ c4 += z4 * c6;
+ c0 += z8 * c4;
+ return s * c0;
+ }
+ z = (z - 0.03125) - 0.0625 * v;
+ const double *c = C[i - 7];
+ double z2 = z * z, z4 = z2 * z2;
+ double c0 = c[0] + z * c[1];
+ double c2 = c[2] + z * c[3];
+ double c4 = c[4] + z * c[5];
+ double c6 = c[6] + z * c[7];
+ c0 += z2 * c2;
+ c4 += z2 * c6;
+ c0 += z4 * c4;
+ return copysign (c0, s);
}
libm_alias_float (__erf, erf)
-
diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps
index ba070f8224..2af6da3638 100644
--- a/sysdeps/loongarch/lp64/libm-test-ulps
+++ b/sysdeps/loongarch/lp64/libm-test-ulps
@@ -909,22 +909,18 @@ ldouble: 5
Function: "erf":
double: 1
-float: 1
ldouble: 1
Function: "erf_downward":
double: 1
-float: 1
ldouble: 2
Function: "erf_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "erf_upward":
double: 1
-float: 1
ldouble: 2
Function: "erfc":
diff --git a/sysdeps/m68k/m680x0/fpu/libm-test-ulps b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
index 8456a59010..3ea3f74e89 100644
--- a/sysdeps/m68k/m680x0/fpu/libm-test-ulps
+++ b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
@@ -839,21 +839,17 @@ ldouble: 5
Function: "erf":
double: 1
-float: 1
ldouble: 1
Function: "erf_downward":
double: 1
-float: 1
Function: "erf_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "erf_upward":
double: 1
-float: 1
ldouble: 1
Function: "erfc":
diff --git a/sysdeps/microblaze/libm-test-ulps b/sysdeps/microblaze/libm-test-ulps
index c89096defd..c079a4f501 100644
--- a/sysdeps/microblaze/libm-test-ulps
+++ b/sysdeps/microblaze/libm-test-ulps
@@ -172,7 +172,6 @@ float: 2
Function: "erf":
double: 1
-float: 1
Function: "erfc":
double: 3
diff --git a/sysdeps/mips/mips32/libm-test-ulps b/sysdeps/mips/mips32/libm-test-ulps
index cef264d649..ebd88e0cef 100644
--- a/sysdeps/mips/mips32/libm-test-ulps
+++ b/sysdeps/mips/mips32/libm-test-ulps
@@ -723,19 +723,15 @@ float: 3
Function: "erf":
double: 1
-float: 1
Function: "erf_downward":
double: 1
-float: 1
Function: "erf_towardzero":
double: 1
-float: 1
Function: "erf_upward":
double: 1
-float: 1
Function: "erfc":
double: 5
diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
index 724249d3ad..ca658b945c 100644
--- a/sysdeps/mips/mips64/libm-test-ulps
+++ b/sysdeps/mips/mips64/libm-test-ulps
@@ -909,22 +909,18 @@ ldouble: 5
Function: "erf":
double: 1
-float: 1
ldouble: 1
Function: "erf_downward":
double: 1
-float: 1
ldouble: 2
Function: "erf_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "erf_upward":
double: 1
-float: 1
ldouble: 2
Function: "erfc":
diff --git a/sysdeps/nios2/libm-test-ulps b/sysdeps/nios2/libm-test-ulps
index dbccba13cb..6416c7ff38 100644
--- a/sysdeps/nios2/libm-test-ulps
+++ b/sysdeps/nios2/libm-test-ulps
@@ -177,7 +177,6 @@ float: 2
Function: "erf":
double: 1
-float: 1
Function: "erfc":
double: 5
diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps
index df2b69ac75..fb1606801b 100644
--- a/sysdeps/or1k/fpu/libm-test-ulps
+++ b/sysdeps/or1k/fpu/libm-test-ulps
@@ -723,19 +723,15 @@ float: 3
Function: "erf":
double: 1
-float: 1
Function: "erf_downward":
double: 1
-float: 1
Function: "erf_towardzero":
double: 1
-float: 1
Function: "erf_upward":
double: 1
-float: 1
Function: "erfc":
double: 5
diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps
index 2263f3f0b7..2742e3b8be 100644
--- a/sysdeps/or1k/nofpu/libm-test-ulps
+++ b/sysdeps/or1k/nofpu/libm-test-ulps
@@ -723,19 +723,15 @@ float: 3
Function: "erf":
double: 1
-float: 1
Function: "erf_downward":
double: 1
-float: 1
Function: "erf_towardzero":
double: 1
-float: 1
Function: "erf_upward":
double: 1
-float: 1
Function: "erfc":
double: 5
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index 36fa54d97e..b22aaf90bd 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -1105,25 +1105,21 @@ double: 1
Function: "erf":
double: 1
-float: 1
float128: 1
ldouble: 1
Function: "erf_downward":
double: 1
-float: 1
float128: 2
ldouble: 2
Function: "erf_towardzero":
double: 1
-float: 1
float128: 1
ldouble: 2
Function: "erf_upward":
double: 1
-float: 1
float128: 2
ldouble: 3
diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
index c32c8017b4..98cd67bd07 100644
--- a/sysdeps/powerpc/nofpu/libm-test-ulps
+++ b/sysdeps/powerpc/nofpu/libm-test-ulps
@@ -919,22 +919,18 @@ double: 1
Function: "erf":
double: 1
-float: 1
ldouble: 1
Function: "erf_downward":
double: 1
-float: 1
ldouble: 2
Function: "erf_towardzero":
double: 1
-float: 1
ldouble: 2
Function: "erf_upward":
double: 1
-float: 1
ldouble: 2
Function: "erfc":
diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps
index 79927c2bd9..8cfeb7bcb2 100644
--- a/sysdeps/riscv/nofpu/libm-test-ulps
+++ b/sysdeps/riscv/nofpu/libm-test-ulps
@@ -906,22 +906,18 @@ ldouble: 5
Function: "erf":
double: 1
-float: 1
ldouble: 1
Function: "erf_downward":
double: 1
-float: 1
ldouble: 2
Function: "erf_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "erf_upward":
double: 1
-float: 1
ldouble: 2
Function: "erfc":
diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps
index fbd5b8fed7..f7c6c82dd1 100644
--- a/sysdeps/riscv/rvd/libm-test-ulps
+++ b/sysdeps/riscv/rvd/libm-test-ulps
@@ -909,22 +909,18 @@ ldouble: 5
Function: "erf":
double: 1
-float: 1
ldouble: 1
Function: "erf_downward":
double: 1
-float: 1
ldouble: 2
Function: "erf_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "erf_upward":
double: 1
-float: 1
ldouble: 2
Function: "erfc":
diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
index ade5a39db4..36da5d742a 100644
--- a/sysdeps/s390/fpu/libm-test-ulps
+++ b/sysdeps/s390/fpu/libm-test-ulps
@@ -910,22 +910,18 @@ ldouble: 5
Function: "erf":
double: 1
-float: 1
ldouble: 1
Function: "erf_downward":
double: 1
-float: 1
ldouble: 2
Function: "erf_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "erf_upward":
double: 1
-float: 1
ldouble: 2
Function: "erfc":
diff --git a/sysdeps/sh/libm-test-ulps b/sysdeps/sh/libm-test-ulps
index b0040d7218..6b55797f81 100644
--- a/sysdeps/sh/libm-test-ulps
+++ b/sysdeps/sh/libm-test-ulps
@@ -355,11 +355,9 @@ float: 3
Function: "erf":
double: 1
-float: 1
Function: "erf_towardzero":
double: 1
-float: 1
Function: "erfc":
double: 5
diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
index d78b46b97b..3aed9d4d06 100644
--- a/sysdeps/sparc/fpu/libm-test-ulps
+++ b/sysdeps/sparc/fpu/libm-test-ulps
@@ -909,22 +909,18 @@ ldouble: 5
Function: "erf":
double: 1
-float: 1
ldouble: 1
Function: "erf_downward":
double: 1
-float: 1
ldouble: 2
Function: "erf_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "erf_upward":
double: 1
-float: 1
ldouble: 2
Function: "erfc":
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index 327937929d..e00ad56c62 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -1290,25 +1290,21 @@ ldouble: 3
Function: "erf":
double: 1
-float: 1
float128: 1
ldouble: 1
Function: "erf_downward":
double: 1
-float: 1
float128: 2
ldouble: 1
Function: "erf_towardzero":
double: 1
-float: 1
float128: 1
ldouble: 1
Function: "erf_upward":
double: 1
-float: 1
float128: 2
ldouble: 1
--
2.43.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 09/11] math: Use erfcf from CORE-MATH
2024-11-11 13:45 [PATCH 00/11] Add more CORE-math implementations to libm Adhemerval Zanella
` (7 preceding siblings ...)
2024-11-11 13:45 ` [PATCH 08/11] math: Use erff from CORE-MATH Adhemerval Zanella
@ 2024-11-11 13:45 ` Adhemerval Zanella
2024-11-21 1:35 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 10/11] math: Use lgammaf " Adhemerval Zanella
2024-11-11 13:45 ` [PATCH 11/11] math: Use tanf " Adhemerval Zanella
10 siblings, 1 reply; 34+ messages in thread
From: Adhemerval Zanella @ 2024-11-11 13:45 UTC (permalink / raw)
To: libc-alpha; +Cc: Alexei Sibidanov, Paul Zimmermann
The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance to the generic erfcf.
The code was adapted to glibc style and to use the definition of
math_config.h.
Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (M1,
gcc 13.2.1), and powerpc (POWER10, gcc 13.2.1):
latency master patched improvement
x86_64 98.8796 66.2142 33.04%
x86_64v2 98.9617 67.4221 31.87%
x86_64v3 87.4161 53.1754 39.17%
aarch64 33.8336 22.0781 34.75%
power10 21.1750 13.5864 35.84%
powerpc 21.4694 13.8149 35.65%
reciprocal-throughput master patched improvement
x86_64 48.5620 27.6731 43.01%
x86_64v2 47.9497 28.3804 40.81%
x86_64v3 42.0255 18.1355 56.85%
aarch64 24.3938 13.4041 45.05%
power10 10.4919 6.1881 41.02%
powerpc 11.763 6.76468 42.49%
Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
---
SHARED-FILES | 4 +
sysdeps/alpha/fpu/libm-test-ulps | 4 -
sysdeps/arc/fpu/libm-test-ulps | 4 -
sysdeps/arc/nofpu/libm-test-ulps | 1 -
sysdeps/arm/libm-test-ulps | 4 -
sysdeps/csky/fpu/libm-test-ulps | 4 -
sysdeps/csky/nofpu/libm-test-ulps | 4 -
sysdeps/hppa/fpu/libm-test-ulps | 4 -
sysdeps/i386/fpu/libm-test-ulps | 4 -
.../i386/i686/fpu/multiarch/libm-test-ulps | 4 -
sysdeps/ieee754/flt-32/s_erfcf.c | 332 +++++++++---------
sysdeps/loongarch/lp64/libm-test-ulps | 4 -
sysdeps/m68k/m680x0/fpu/libm-test-ulps | 4 -
sysdeps/microblaze/libm-test-ulps | 1 -
sysdeps/mips/mips32/libm-test-ulps | 4 -
sysdeps/mips/mips64/libm-test-ulps | 4 -
sysdeps/nios2/libm-test-ulps | 1 -
sysdeps/or1k/fpu/libm-test-ulps | 4 -
sysdeps/or1k/nofpu/libm-test-ulps | 4 -
sysdeps/powerpc/fpu/libm-test-ulps | 4 -
sysdeps/powerpc/nofpu/libm-test-ulps | 4 -
sysdeps/riscv/nofpu/libm-test-ulps | 4 -
sysdeps/riscv/rvd/libm-test-ulps | 4 -
sysdeps/s390/fpu/libm-test-ulps | 4 -
sysdeps/sh/libm-test-ulps | 2 -
sysdeps/sparc/fpu/libm-test-ulps | 4 -
sysdeps/x86_64/fpu/libm-test-ulps | 4 -
27 files changed, 176 insertions(+), 249 deletions(-)
diff --git a/SHARED-FILES b/SHARED-FILES
index ccc5179f80..e6e29bcadc 100644
--- a/SHARED-FILES
+++ b/SHARED-FILES
@@ -276,3 +276,7 @@ sysdeps/ieee754/flt-32/s_erff.c
(file src/binary32/erf/erff.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
+sysdeps/ieee754/flt-32/s_erfcf.c
+ (file src/binary32/erfc/erfcf.c in CORE-MATH)
+ - The code was adapted to use glibc code style and internal
+ functions to handle errno, overflow, and underflow.
diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
index bbb3a5c459..3678bc38e3 100644
--- a/sysdeps/alpha/fpu/libm-test-ulps
+++ b/sysdeps/alpha/fpu/libm-test-ulps
@@ -925,22 +925,18 @@ ldouble: 2
Function: "erfc":
double: 5
-float: 3
ldouble: 4
Function: "erfc_downward":
double: 5
-float: 6
ldouble: 5
Function: "erfc_towardzero":
double: 3
-float: 4
ldouble: 4
Function: "erfc_upward":
double: 5
-float: 6
ldouble: 5
Function: "exp":
diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
index 9e422da289..68d67b6a67 100644
--- a/sysdeps/arc/fpu/libm-test-ulps
+++ b/sysdeps/arc/fpu/libm-test-ulps
@@ -745,19 +745,15 @@ double: 2
Function: "erfc":
double: 5
-float: 5
Function: "erfc_downward":
double: 4
-float: 4
Function: "erfc_towardzero":
double: 4
-float: 4
Function: "erfc_upward":
double: 5
-float: 5
Function: "exp":
double: 1
diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps
index 2c24fdf663..dc2499b56a 100644
--- a/sysdeps/arc/nofpu/libm-test-ulps
+++ b/sysdeps/arc/nofpu/libm-test-ulps
@@ -180,7 +180,6 @@ double: 1
Function: "erfc":
double: 5
-float: 3
Function: "exp":
double: 1
diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
index 153cd1f3d7..000a5af492 100644
--- a/sysdeps/arm/libm-test-ulps
+++ b/sysdeps/arm/libm-test-ulps
@@ -738,19 +738,15 @@ double: 1
Function: "erfc":
double: 5
-float: 3
Function: "erfc_downward":
double: 5
-float: 6
Function: "erfc_towardzero":
double: 3
-float: 4
Function: "erfc_upward":
double: 5
-float: 6
Function: "exp":
double: 1
diff --git a/sysdeps/csky/fpu/libm-test-ulps b/sysdeps/csky/fpu/libm-test-ulps
index d276db245b..ed373cd353 100644
--- a/sysdeps/csky/fpu/libm-test-ulps
+++ b/sysdeps/csky/fpu/libm-test-ulps
@@ -731,19 +731,15 @@ double: 1
Function: "erfc":
double: 5
-float: 3
Function: "erfc_downward":
double: 5
-float: 6
Function: "erfc_towardzero":
double: 3
-float: 4
Function: "erfc_upward":
double: 5
-float: 6
Function: "exp":
double: 1
diff --git a/sysdeps/csky/nofpu/libm-test-ulps b/sysdeps/csky/nofpu/libm-test-ulps
index ea08fd5378..48a8c7351f 100644
--- a/sysdeps/csky/nofpu/libm-test-ulps
+++ b/sysdeps/csky/nofpu/libm-test-ulps
@@ -729,19 +729,15 @@ double: 1
Function: "erfc":
double: 5
-float: 3
Function: "erfc_downward":
double: 5
-float: 6
Function: "erfc_towardzero":
double: 3
-float: 4
Function: "erfc_upward":
double: 5
-float: 6
Function: "exp":
double: 1
diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
index 7e4f6ebe77..19087298e9 100644
--- a/sysdeps/hppa/fpu/libm-test-ulps
+++ b/sysdeps/hppa/fpu/libm-test-ulps
@@ -752,20 +752,16 @@ double: 1
Function: "erfc":
double: 5
-float: 3
ldouble: 1
Function: "erfc_downward":
double: 5
-float: 6
Function: "erfc_towardzero":
double: 3
-float: 4
Function: "erfc_upward":
double: 5
-float: 6
Function: "exp":
double: 1
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 041c180f7a..5284078bee 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -1098,25 +1098,21 @@ ldouble: 1
Function: "erfc":
double: 5
-float: 3
float128: 4
ldouble: 5
Function: "erfc_downward":
double: 5
-float: 6
float128: 5
ldouble: 4
Function: "erfc_towardzero":
double: 3
-float: 4
float128: 4
ldouble: 4
Function: "erfc_upward":
double: 5
-float: 6
float128: 5
ldouble: 5
diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
index e3ee0c61f6..da00d80ba7 100644
--- a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
+++ b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
@@ -1101,25 +1101,21 @@ ldouble: 1
Function: "erfc":
double: 5
-float: 3
float128: 4
ldouble: 5
Function: "erfc_downward":
double: 5
-float: 6
float128: 5
ldouble: 4
Function: "erfc_towardzero":
double: 3
-float: 4
float128: 4
ldouble: 4
Function: "erfc_upward":
double: 5
-float: 6
float128: 5
ldouble: 5
diff --git a/sysdeps/ieee754/flt-32/s_erfcf.c b/sysdeps/ieee754/flt-32/s_erfcf.c
index fdba278eff..6f8c7c6a57 100644
--- a/sysdeps/ieee754/flt-32/s_erfcf.c
+++ b/sysdeps/ieee754/flt-32/s_erfcf.c
@@ -1,173 +1,185 @@
-/* s_erfcf.c -- float version of s_erfc.c.
- */
+/* Correctly-rounded complementary error function for the binary32 format
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+Copyright (c) 2023, 2024 Alexei Sibidanov.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_erff.c,v 1.4 1995/05/10 20:47:07 jtc Exp $";
-#endif
+This file is part of the CORE-MATH project
+project (file src/binary32/erfc/erfcf.c revision bc385c2).
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
#include <errno.h>
-#include <fix-int-fp-convert-zero.h>
-#include <libm-alias-float.h>
-#include <math-narrow-eval.h>
#include <math.h>
-#include <math_private.h>
-
+#include <stdint.h>
+#include <libm-alias-float.h>
+#include "math_config.h"
-static const float
-tiny = 1e-30,
-half= 5.0000000000e-01, /* 0x3F000000 */
-one = 1.0000000000e+00, /* 0x3F800000 */
-two = 2.0000000000e+00, /* 0x40000000 */
- /* c = (subfloat)0.84506291151 */
-erx = 8.4506291151e-01, /* 0x3f58560b */
-/*
- * Coefficients for approximation to erf on [0,0.84375]
- */
-pp0 = 1.2837916613e-01, /* 0x3e0375d4 */
-pp1 = -3.2504209876e-01, /* 0xbea66beb */
-pp2 = -2.8481749818e-02, /* 0xbce9528f */
-pp3 = -5.7702702470e-03, /* 0xbbbd1489 */
-pp4 = -2.3763017452e-05, /* 0xb7c756b1 */
-qq1 = 3.9791721106e-01, /* 0x3ecbbbce */
-qq2 = 6.5022252500e-02, /* 0x3d852a63 */
-qq3 = 5.0813062117e-03, /* 0x3ba68116 */
-qq4 = 1.3249473704e-04, /* 0x390aee49 */
-qq5 = -3.9602282413e-06, /* 0xb684e21a */
-/*
- * Coefficients for approximation to erf in [0.84375,1.25]
- */
-pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */
-pa1 = 4.1485610604e-01, /* 0x3ed46805 */
-pa2 = -3.7220788002e-01, /* 0xbebe9208 */
-pa3 = 3.1834661961e-01, /* 0x3ea2fe54 */
-pa4 = -1.1089469492e-01, /* 0xbde31cc2 */
-pa5 = 3.5478305072e-02, /* 0x3d1151b3 */
-pa6 = -2.1663755178e-03, /* 0xbb0df9c0 */
-qa1 = 1.0642088205e-01, /* 0x3dd9f331 */
-qa2 = 5.4039794207e-01, /* 0x3f0a5785 */
-qa3 = 7.1828655899e-02, /* 0x3d931ae7 */
-qa4 = 1.2617121637e-01, /* 0x3e013307 */
-qa5 = 1.3637083583e-02, /* 0x3c5f6e13 */
-qa6 = 1.1984500103e-02, /* 0x3c445aa3 */
-/*
- * Coefficients for approximation to erfc in [1.25,1/0.35]
- */
-ra0 = -9.8649440333e-03, /* 0xbc21a093 */
-ra1 = -6.9385856390e-01, /* 0xbf31a0b7 */
-ra2 = -1.0558626175e+01, /* 0xc128f022 */
-ra3 = -6.2375331879e+01, /* 0xc2798057 */
-ra4 = -1.6239666748e+02, /* 0xc322658c */
-ra5 = -1.8460508728e+02, /* 0xc3389ae7 */
-ra6 = -8.1287437439e+01, /* 0xc2a2932b */
-ra7 = -9.8143291473e+00, /* 0xc11d077e */
-sa1 = 1.9651271820e+01, /* 0x419d35ce */
-sa2 = 1.3765776062e+02, /* 0x4309a863 */
-sa3 = 4.3456588745e+02, /* 0x43d9486f */
-sa4 = 6.4538726807e+02, /* 0x442158c9 */
-sa5 = 4.2900814819e+02, /* 0x43d6810b */
-sa6 = 1.0863500214e+02, /* 0x42d9451f */
-sa7 = 6.5702495575e+00, /* 0x40d23f7c */
-sa8 = -6.0424413532e-02, /* 0xbd777f97 */
-/*
- * Coefficients for approximation to erfc in [1/.35,28]
- */
-rb0 = -9.8649431020e-03, /* 0xbc21a092 */
-rb1 = -7.9928326607e-01, /* 0xbf4c9dd4 */
-rb2 = -1.7757955551e+01, /* 0xc18e104b */
-rb3 = -1.6063638306e+02, /* 0xc320a2ea */
-rb4 = -6.3756646729e+02, /* 0xc41f6441 */
-rb5 = -1.0250950928e+03, /* 0xc480230b */
-rb6 = -4.8351919556e+02, /* 0xc3f1c275 */
-sb1 = 3.0338060379e+01, /* 0x41f2b459 */
-sb2 = 3.2579251099e+02, /* 0x43a2e571 */
-sb3 = 1.5367296143e+03, /* 0x44c01759 */
-sb4 = 3.1998581543e+03, /* 0x4547fdbb */
-sb5 = 2.5530502930e+03, /* 0x451f90ce */
-sb6 = 4.7452853394e+02, /* 0x43ed43a7 */
-sb7 = -2.2440952301e+01; /* 0xc1b38712 */
+static const double E[] =
+ {
+ 0x1p+0, 0x1.0163da9fb3335p+0, 0x1.02c9a3e778061p+0,
+ 0x1.04315e86e7f85p+0, 0x1.059b0d3158574p+0, 0x1.0706b29ddf6dep+0,
+ 0x1.0874518759bc8p+0, 0x1.09e3ecac6f383p+0, 0x1.0b5586cf9890fp+0,
+ 0x1.0cc922b7247f7p+0, 0x1.0e3ec32d3d1a2p+0, 0x1.0fb66affed31bp+0,
+ 0x1.11301d0125b51p+0, 0x1.12abdc06c31ccp+0, 0x1.1429aaea92dep+0,
+ 0x1.15a98c8a58e51p+0, 0x1.172b83c7d517bp+0, 0x1.18af9388c8deap+0,
+ 0x1.1a35beb6fcb75p+0, 0x1.1bbe084045cd4p+0, 0x1.1d4873168b9aap+0,
+ 0x1.1ed5022fcd91dp+0, 0x1.2063b88628cd6p+0, 0x1.21f49917ddc96p+0,
+ 0x1.2387a6e756238p+0, 0x1.251ce4fb2a63fp+0, 0x1.26b4565e27cddp+0,
+ 0x1.284dfe1f56381p+0, 0x1.29e9df51fdee1p+0, 0x1.2b87fd0dad99p+0,
+ 0x1.2d285a6e4030bp+0, 0x1.2ecafa93e2f56p+0, 0x1.306fe0a31b715p+0,
+ 0x1.32170fc4cd831p+0, 0x1.33c08b26416ffp+0, 0x1.356c55f929ff1p+0,
+ 0x1.371a7373aa9cbp+0, 0x1.38cae6d05d866p+0, 0x1.3a7db34e59ff7p+0,
+ 0x1.3c32dc313a8e5p+0, 0x1.3dea64c123422p+0, 0x1.3fa4504ac801cp+0,
+ 0x1.4160a21f72e2ap+0, 0x1.431f5d950a897p+0, 0x1.44e086061892dp+0,
+ 0x1.46a41ed1d0057p+0, 0x1.486a2b5c13cdp+0, 0x1.4a32af0d7d3dep+0,
+ 0x1.4bfdad5362a27p+0, 0x1.4dcb299fddd0dp+0, 0x1.4f9b2769d2ca7p+0,
+ 0x1.516daa2cf6642p+0, 0x1.5342b569d4f82p+0, 0x1.551a4ca5d920fp+0,
+ 0x1.56f4736b527dap+0, 0x1.58d12d497c7fdp+0, 0x1.5ab07dd485429p+0,
+ 0x1.5c9268a5946b7p+0, 0x1.5e76f15ad2148p+0, 0x1.605e1b976dc09p+0,
+ 0x1.6247eb03a5585p+0, 0x1.6434634ccc32p+0, 0x1.6623882552225p+0,
+ 0x1.68155d44ca973p+0, 0x1.6a09e667f3bcdp+0, 0x1.6c012750bdabfp+0,
+ 0x1.6dfb23c651a2fp+0, 0x1.6ff7df9519484p+0, 0x1.71f75e8ec5f74p+0,
+ 0x1.73f9a48a58174p+0, 0x1.75feb564267c9p+0, 0x1.780694fde5d3fp+0,
+ 0x1.7a11473eb0187p+0, 0x1.7c1ed0130c132p+0, 0x1.7e2f336cf4e62p+0,
+ 0x1.80427543e1a12p+0, 0x1.82589994cce13p+0, 0x1.8471a4623c7adp+0,
+ 0x1.868d99b4492edp+0, 0x1.88ac7d98a6699p+0, 0x1.8ace5422aa0dbp+0,
+ 0x1.8cf3216b5448cp+0, 0x1.8f1ae99157736p+0, 0x1.9145b0b91ffc6p+0,
+ 0x1.93737b0cdc5e5p+0, 0x1.95a44cbc8520fp+0, 0x1.97d829fde4e5p+0,
+ 0x1.9a0f170ca07bap+0, 0x1.9c49182a3f09p+0, 0x1.9e86319e32323p+0,
+ 0x1.a0c667b5de565p+0, 0x1.a309bec4a2d33p+0, 0x1.a5503b23e255dp+0,
+ 0x1.a799e1330b358p+0, 0x1.a9e6b5579fdbfp+0, 0x1.ac36bbfd3f37ap+0,
+ 0x1.ae89f995ad3adp+0, 0x1.b0e07298db666p+0, 0x1.b33a2b84f15fbp+0,
+ 0x1.b59728de5593ap+0, 0x1.b7f76f2fb5e47p+0, 0x1.ba5b030a1064ap+0,
+ 0x1.bcc1e904bc1d2p+0, 0x1.bf2c25bd71e09p+0, 0x1.c199bdd85529cp+0,
+ 0x1.c40ab5fffd07ap+0, 0x1.c67f12e57d14bp+0, 0x1.c8f6d9406e7b5p+0,
+ 0x1.cb720dcef9069p+0, 0x1.cdf0b555dc3fap+0, 0x1.d072d4a07897cp+0,
+ 0x1.d2f87080d89f2p+0, 0x1.d5818dcfba487p+0, 0x1.d80e316c98398p+0,
+ 0x1.da9e603db3285p+0, 0x1.dd321f301b46p+0, 0x1.dfc97337b9b5fp+0,
+ 0x1.e264614f5a129p+0, 0x1.e502ee78b3ff6p+0, 0x1.e7a51fbc74c83p+0,
+ 0x1.ea4afa2a490dap+0, 0x1.ecf482d8e67f1p+0, 0x1.efa1bee615a27p+0,
+ 0x1.f252b376bba97p+0, 0x1.f50765b6e454p+0, 0x1.f7bfdad9cbe14p+0,
+ 0x1.fa7c1819e90d8p+0, 0x1.fd3c22b8f71f1p+0
+ };
-float __erfcf(float x)
+float
+__erfcf (float xf)
{
- int32_t hx,ix;
- float R,S,P,Q,s,y,z,r;
- GET_FLOAT_WORD(hx,x);
- ix = hx&0x7fffffff;
- if(ix>=0x7f800000) { /* erfc(nan)=nan */
- /* erfc(+-inf)=0,2 */
- float ret = (float)(((uint32_t)hx>>31)<<1)+one/x;
- if (FIX_INT_FP_CONVERT_ZERO && ret == 0.0f)
- return 0.0f;
- return ret;
- }
-
- if(ix < 0x3f580000) { /* |x|<0.84375 */
- if(ix < 0x32800000) /* |x|<2**-26 */
- return one-x;
- z = x*x;
- r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
- s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
- y = r/s;
- if(hx < 0x3e800000) { /* x<1/4 */
- return one-(x+x*y);
- } else {
- r = x*y;
- r += (x-half);
- return half - r ;
- }
+ float axf = fabsf (xf);
+ double axd = axf;
+ double x2 = axd * axd;
+ uint32_t t = asuint (xf);
+ unsigned int at = t & (~0u >> 1);
+ unsigned int sgn = t >> 31;
+ int64_t i = at > 0x40051000;
+ /* for x < -0x1.ea8f94p+1, erfc(x) rounds to 2 (to nearest) */
+ if (__glibc_unlikely (t > 0xc07547ca))
+ { /* xf < -0x1.ea8f94p+1 */
+ if (__glibc_unlikely (t >= 0xff800000))
+ { /* -Inf or NaN */
+ if (t == 0xff800000)
+ return 2.0f; /* -Inf */
+ return xf + xf; /* NaN */
}
- if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */
- s = fabsf(x)-one;
- P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
- Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
- if(hx>=0) {
- z = one-erx; return z - P/Q;
- } else {
- z = erx+P/Q; return one+z;
- }
+ return 2.0f - 0x1p-25f; /* rounds to 2 or nextbelow(2) */
+ }
+ /* at is the absolute value of xf
+ for x >= 0x1.41bbf8p+3, erfc(x) < 2^-150, thus rounds to 0 or 2^-149 */
+ if (__glibc_unlikely (at >= 0x4120ddfc))
+ { /* |xf| >= 0x1.41bbf8p+3 */
+ if (__glibc_unlikely (at >= 0x7f800000))
+ { /* +Inf or NaN */
+ if (at == 0x7f800000)
+ return 0.0f; /* +Inf */
+ return xf + xf; /* NaN */
}
- if (ix < 0x41e00000) { /* |x|<28 */
- x = fabsf(x);
- s = one/(x*x);
- if(ix< 0x4036DB6D) { /* |x| < 1/.35 ~ 2.857143*/
- R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
- ra5+s*(ra6+s*ra7))))));
- S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
- sa5+s*(sa6+s*(sa7+s*sa8)))))));
- } else { /* |x| >= 1/.35 ~ 2.857143 */
- if(hx<0&&ix>=0x40c00000) return two-tiny;/* x < -6 */
- R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
- rb5+s*rb6)))));
- S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
- sb5+s*(sb6+s*sb7))))));
- }
- GET_FLOAT_WORD(ix,x);
- SET_FLOAT_WORD(z,ix&0xffffe000);
- r = __ieee754_expf(-z*z-(float)0.5625)*
- __ieee754_expf((z-x)*(z+x)+R/S);
- if(hx>0) {
- float ret = math_narrow_eval (r/x);
- if (ret == 0)
- __set_errno (ERANGE);
- return ret;
- } else
- return two-r/x;
- } else {
- if(hx>0) {
- __set_errno (ERANGE);
- return tiny*tiny;
- } else
- return two-tiny;
+ __set_errno (ERANGE);
+ return 0x1p-149f * 0.25f; /* 0 or 2^-149 wrt rounding */
+ }
+ if (__glibc_unlikely (at <= 0x3db80000))
+ { /* |x| <= 0x1.7p-4 */
+ if (__glibc_unlikely (t == 0xb76c9f62))
+ return 0x1.00010ap+0f + 0x1p-25f; /* exceptional case */
+ /* for |x| <= 0x1.c5bf88p-26. erfc(x) rounds to 1 (to nearest) */
+ if (__glibc_unlikely (at <= 0x32e2dfc4))
+ { /* |x| <= 0x1.c5bf88p-26 */
+ if (__glibc_unlikely (at == 0))
+ return 1.0f;
+ static const float d[] = { -0x1p-26, 0x1p-25 };
+ return 1.0f + d[sgn];
}
+ /* around 0, erfc(x) behaves as 1 + (odd polynomial) */
+ static const double c[] =
+ {
+ 0x1.20dd750429b6dp+0, -0x1.812746b03610bp-2, 0x1.ce2f218831d2fp-4,
+ -0x1.b82c609607dcbp-6, 0x1.553af09b8008ep-8
+ };
+ double f0 = xf
+ * (c[0] + x2 * (c[1] + x2 * (c[2] + x2 * (c[3] + x2 * (c[4])))));
+ return 1.0 - f0;
+ }
+
+ /* now -0x1.ea8f94p+1 <= x <= 0x1.41bbf8p+3, with |x| > 0x1.7p-4 */
+ const double iln2 = 0x1.71547652b82fep+0;
+ const double ln2h = 0x1.62e42fefap-8;
+ const double ln2l = 0x1.cf79abd6f5dc8p-47;
+ uint64_t jt = asuint64 (fma (x2, iln2, -(1024 + 0x1p-8)));
+ int64_t j = (int64_t) (jt << 12) >> 48;
+ double S = asdouble (((j >> 7) + (0x3ff | sgn << 11)) << 52);
+ static const double ch[] =
+ {
+ -0x1.ffffffffff333p-2, 0x1.5555555556a14p-3, -0x1.55556666659b4p-5,
+ 0x1.1111074cc7b22p-7
+ };
+ double d = (x2 + ln2h * j) + ln2l * j;
+ double d2 = d * d;
+ double e0 = E[j & 127];
+ double f = d + d2 * ((ch[0] + d * ch[1]) + d2 * (ch[2] + d * ch[3]));
+ static const double ct[][16] =
+ {
+ {
+ 0x1.c162355429b28p-1, 3.70, 0x1.da951cece2b85p-2,
+ -0x1.70ef6cff4bcc4p+0, 0x1.3d7f7b3d617dep+1, -0x1.9d0aa47537c51p+1,
+ 0x1.9754ea9a3fcb1p+1, -0x1.27a5453fcc015p+1, 0x1.1ef2e0531aebap+0,
+ -0x1.eca090f5a1c06p-3, -0x1.7a3cd173a063cp-4, 0x1.30fa68a68fdddp-4,
+ 0x1.55ad9a326993ap-10, -0x1.07e7b0bb39fbfp-6, 0x1.2328706c0e95p-10,
+ 0x1.d6aa0b7b19cfep-9
+ },
+ {
+ 0x1.137c8983f8516p+2, 2.95, 0x1.05b53aa241333p-3,
+ -0x1.a3f53872bf87p-3, 0x1.de4c30742c9d5p-4, -0x1.cb24bfa591986p-5,
+ 0x1.666aec059ca5fp-6, -0x1.a61250eb26b0bp-8, 0x1.2b28b7924b34dp-10,
+ 0x1.41b13a9d45013p-15, -0x1.6dd5e8a273613p-14, 0x1.09ce8ea5e8da5p-16,
+ 0x1.33923b4102981p-18, -0x1.1dfd161e3f984p-19, -0x1.c87618fcae3b3p-23,
+ 0x1.e8a6ffa0ba2c7p-23
+ }
+ };
+ double z = (axd - ct[i][0]) / (axd + ct[i][1]);
+ double z2 = z * z, z4 = z2 * z2;
+ double z8 = z4 * z4;
+ const double *c = ct[i] + 3;
+ double s = (((c[0] + z * c[1]) + z2 * (c[2] + z * c[3]))
+ + z4 * ((c[4] + z * c[5]) + z2 * (c[6] + z * c[7])))
+ + z8 * (((c[8] + z * c[9]) + z2 * (c[10] + z * c[11])) + z4 * (c[12]));
+ s = ct[i][2] + z * s;
+ static const double off[] = { 0, 2 };
+ double r = (S * (e0 - f * e0)) * s;
+ double y = off[sgn] + r;
+ return y;
}
libm_alias_float (__erfc, erfc)
diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps
index 2af6da3638..759050a3c3 100644
--- a/sysdeps/loongarch/lp64/libm-test-ulps
+++ b/sysdeps/loongarch/lp64/libm-test-ulps
@@ -925,22 +925,18 @@ ldouble: 2
Function: "erfc":
double: 5
-float: 3
ldouble: 4
Function: "erfc_downward":
double: 5
-float: 6
ldouble: 5
Function: "erfc_towardzero":
double: 3
-float: 4
ldouble: 4
Function: "erfc_upward":
double: 5
-float: 6
ldouble: 5
Function: "exp":
diff --git a/sysdeps/m68k/m680x0/fpu/libm-test-ulps b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
index 3ea3f74e89..08fbad9c4a 100644
--- a/sysdeps/m68k/m680x0/fpu/libm-test-ulps
+++ b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
@@ -854,22 +854,18 @@ ldouble: 1
Function: "erfc":
double: 1
-float: 2
ldouble: 2
Function: "erfc_downward":
double: 1
-float: 4
ldouble: 4
Function: "erfc_towardzero":
double: 1
-float: 4
ldouble: 4
Function: "erfc_upward":
double: 1
-float: 3
ldouble: 3
Function: "exp10m1":
diff --git a/sysdeps/microblaze/libm-test-ulps b/sysdeps/microblaze/libm-test-ulps
index c079a4f501..5382a18115 100644
--- a/sysdeps/microblaze/libm-test-ulps
+++ b/sysdeps/microblaze/libm-test-ulps
@@ -175,7 +175,6 @@ double: 1
Function: "erfc":
double: 3
-float: 2
Function: "exp":
float: 1
diff --git a/sysdeps/mips/mips32/libm-test-ulps b/sysdeps/mips/mips32/libm-test-ulps
index ebd88e0cef..0fe27ef417 100644
--- a/sysdeps/mips/mips32/libm-test-ulps
+++ b/sysdeps/mips/mips32/libm-test-ulps
@@ -735,19 +735,15 @@ double: 1
Function: "erfc":
double: 5
-float: 3
Function: "erfc_downward":
double: 5
-float: 6
Function: "erfc_towardzero":
double: 3
-float: 4
Function: "erfc_upward":
double: 5
-float: 6
Function: "exp":
double: 1
diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
index ca658b945c..ce7dde2e65 100644
--- a/sysdeps/mips/mips64/libm-test-ulps
+++ b/sysdeps/mips/mips64/libm-test-ulps
@@ -925,22 +925,18 @@ ldouble: 2
Function: "erfc":
double: 5
-float: 3
ldouble: 4
Function: "erfc_downward":
double: 5
-float: 6
ldouble: 5
Function: "erfc_towardzero":
double: 3
-float: 4
ldouble: 4
Function: "erfc_upward":
double: 5
-float: 6
ldouble: 5
Function: "exp":
diff --git a/sysdeps/nios2/libm-test-ulps b/sysdeps/nios2/libm-test-ulps
index 6416c7ff38..cc63f8fe9f 100644
--- a/sysdeps/nios2/libm-test-ulps
+++ b/sysdeps/nios2/libm-test-ulps
@@ -180,7 +180,6 @@ double: 1
Function: "erfc":
double: 5
-float: 3
Function: "exp":
double: 1
diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps
index fb1606801b..5677a353ed 100644
--- a/sysdeps/or1k/fpu/libm-test-ulps
+++ b/sysdeps/or1k/fpu/libm-test-ulps
@@ -735,19 +735,15 @@ double: 1
Function: "erfc":
double: 5
-float: 3
Function: "erfc_downward":
double: 5
-float: 6
Function: "erfc_towardzero":
double: 3
-float: 4
Function: "erfc_upward":
double: 5
-float: 6
Function: "exp":
double: 1
diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps
index 2742e3b8be..c7ba12fe19 100644
--- a/sysdeps/or1k/nofpu/libm-test-ulps
+++ b/sysdeps/or1k/nofpu/libm-test-ulps
@@ -735,19 +735,15 @@ double: 1
Function: "erfc":
double: 5
-float: 3
Function: "erfc_downward":
double: 5
-float: 6
Function: "erfc_towardzero":
double: 3
-float: 4
Function: "erfc_upward":
double: 5
-float: 6
Function: "exp":
double: 1
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index b22aaf90bd..4e448a263b 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -1125,25 +1125,21 @@ ldouble: 3
Function: "erfc":
double: 2
-float: 2
float128: 4
ldouble: 3
Function: "erfc_downward":
double: 4
-float: 4
float128: 5
ldouble: 10
Function: "erfc_towardzero":
double: 3
-float: 3
float128: 4
ldouble: 11
Function: "erfc_upward":
double: 4
-float: 4
float128: 5
ldouble: 7
diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
index 98cd67bd07..d9555e7706 100644
--- a/sysdeps/powerpc/nofpu/libm-test-ulps
+++ b/sysdeps/powerpc/nofpu/libm-test-ulps
@@ -935,22 +935,18 @@ ldouble: 2
Function: "erfc":
double: 5
-float: 3
ldouble: 3
Function: "erfc_downward":
double: 5
-float: 6
ldouble: 10
Function: "erfc_towardzero":
double: 3
-float: 4
ldouble: 11
Function: "erfc_upward":
double: 5
-float: 6
ldouble: 7
Function: "exp":
diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps
index 8cfeb7bcb2..23228a80a9 100644
--- a/sysdeps/riscv/nofpu/libm-test-ulps
+++ b/sysdeps/riscv/nofpu/libm-test-ulps
@@ -922,22 +922,18 @@ ldouble: 2
Function: "erfc":
double: 5
-float: 3
ldouble: 4
Function: "erfc_downward":
double: 3
-float: 4
ldouble: 5
Function: "erfc_towardzero":
double: 3
-float: 3
ldouble: 4
Function: "erfc_upward":
double: 3
-float: 4
ldouble: 5
Function: "exp":
diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps
index f7c6c82dd1..74bde1024a 100644
--- a/sysdeps/riscv/rvd/libm-test-ulps
+++ b/sysdeps/riscv/rvd/libm-test-ulps
@@ -925,22 +925,18 @@ ldouble: 2
Function: "erfc":
double: 2
-float: 2
ldouble: 4
Function: "erfc_downward":
double: 4
-float: 4
ldouble: 5
Function: "erfc_towardzero":
double: 3
-float: 3
ldouble: 4
Function: "erfc_upward":
double: 4
-float: 4
ldouble: 5
Function: "exp":
diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
index 36da5d742a..6747fd4f7b 100644
--- a/sysdeps/s390/fpu/libm-test-ulps
+++ b/sysdeps/s390/fpu/libm-test-ulps
@@ -926,22 +926,18 @@ ldouble: 2
Function: "erfc":
double: 2
-float: 2
ldouble: 4
Function: "erfc_downward":
double: 4
-float: 4
ldouble: 5
Function: "erfc_towardzero":
double: 3
-float: 3
ldouble: 4
Function: "erfc_upward":
double: 4
-float: 4
ldouble: 5
Function: "exp":
diff --git a/sysdeps/sh/libm-test-ulps b/sysdeps/sh/libm-test-ulps
index 6b55797f81..69fe20bc0a 100644
--- a/sysdeps/sh/libm-test-ulps
+++ b/sysdeps/sh/libm-test-ulps
@@ -361,11 +361,9 @@ double: 1
Function: "erfc":
double: 5
-float: 2
Function: "erfc_towardzero":
double: 3
-float: 3
Function: "exp":
double: 1
diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
index 3aed9d4d06..98f7a07190 100644
--- a/sysdeps/sparc/fpu/libm-test-ulps
+++ b/sysdeps/sparc/fpu/libm-test-ulps
@@ -925,22 +925,18 @@ ldouble: 2
Function: "erfc":
double: 5
-float: 3
ldouble: 4
Function: "erfc_downward":
double: 5
-float: 6
ldouble: 5
Function: "erfc_towardzero":
double: 3
-float: 4
ldouble: 4
Function: "erfc_upward":
double: 5
-float: 6
ldouble: 5
Function: "exp":
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index e00ad56c62..b7400e9969 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -1330,25 +1330,21 @@ float: 2
Function: "erfc":
double: 5
-float: 3
float128: 4
ldouble: 5
Function: "erfc_downward":
double: 5
-float: 6
float128: 5
ldouble: 4
Function: "erfc_towardzero":
double: 3
-float: 4
float128: 4
ldouble: 4
Function: "erfc_upward":
double: 5
-float: 6
float128: 5
ldouble: 5
--
2.43.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 10/11] math: Use lgammaf from CORE-MATH
2024-11-11 13:45 [PATCH 00/11] Add more CORE-math implementations to libm Adhemerval Zanella
` (8 preceding siblings ...)
2024-11-11 13:45 ` [PATCH 09/11] math: Use erfcf " Adhemerval Zanella
@ 2024-11-11 13:45 ` Adhemerval Zanella
2024-11-21 2:38 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 11/11] math: Use tanf " Adhemerval Zanella
10 siblings, 1 reply; 34+ messages in thread
From: Adhemerval Zanella @ 2024-11-11 13:45 UTC (permalink / raw)
To: libc-alpha; +Cc: Alexei Sibidanov, Paul Zimmermann
The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance to the generic lgammaf.
The code was adapted to glibc style, to use the definition of
math_config.h, to remove errno handling, to use math_narrow_eval
on overflow usage, and to adapt to make it reentrant.
Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (M1,
gcc 13.2.1), and powerpc (POWER10, gcc 13.2.1):
latency master patched improvement
x86_64 86.5609 70.3278 18.75%
x86_64v2 78.3030 69.9709 10.64%
x86_64v3 74.7470 59.8457 19.94%
i686 387.355 229.761 40.68%
aarch64 40.8341 33.7563 17.33%
power10 26.5520 16.1672 39.11%
powerpc 28.3145 17.0625 39.74%
reciprocal-throughput master patched improvement
x86_64 68.0461 48.3098 29.00%
x86_64v2 55.3256 47.2476 14.60%
x86_64v3 52.3015 38.9028 25.62%
i686 340.848 195.707 42.58%
aarch64 36.8000 30.5234 17.06%
power10 20.4043 12.6268 38.12%
powerpc 22.6588 13.8866 38.71%
Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
---
SHARED-FILES | 8 +
sysdeps/aarch64/libm-test-ulps | 4 -
sysdeps/alpha/fpu/libm-test-ulps | 4 -
sysdeps/arc/fpu/libm-test-ulps | 4 -
sysdeps/arc/nofpu/libm-test-ulps | 1 -
sysdeps/arm/libm-test-ulps | 4 -
sysdeps/csky/fpu/libm-test-ulps | 4 -
sysdeps/csky/nofpu/libm-test-ulps | 4 -
sysdeps/hppa/fpu/libm-test-ulps | 4 -
sysdeps/i386/fpu/libm-test-ulps | 4 -
.../i386/i686/fpu/multiarch/libm-test-ulps | 1 -
sysdeps/ieee754/flt-32/e_lgammaf_r.c | 576 +++++++++++-------
sysdeps/ieee754/flt-32/lgamma_negf.c | 283 +--------
sysdeps/loongarch/lp64/libm-test-ulps | 4 -
sysdeps/m68k/coldfire/fpu/libm-test-ulps | 1 -
sysdeps/m68k/m680x0/fpu/libm-test-ulps | 4 -
sysdeps/microblaze/libm-test-ulps | 1 -
sysdeps/mips/mips32/libm-test-ulps | 4 -
sysdeps/mips/mips64/libm-test-ulps | 4 -
sysdeps/nios2/libm-test-ulps | 1 -
sysdeps/or1k/fpu/libm-test-ulps | 4 -
sysdeps/or1k/nofpu/libm-test-ulps | 4 -
sysdeps/powerpc/fpu/libm-test-ulps | 4 -
sysdeps/powerpc/nofpu/libm-test-ulps | 4 -
sysdeps/riscv/nofpu/libm-test-ulps | 4 -
sysdeps/riscv/rvd/libm-test-ulps | 4 -
sysdeps/s390/fpu/libm-test-ulps | 4 -
sysdeps/sh/libm-test-ulps | 2 -
sysdeps/sparc/fpu/libm-test-ulps | 4 -
sysdeps/x86_64/fpu/libm-test-ulps | 4 -
30 files changed, 357 insertions(+), 601 deletions(-)
diff --git a/SHARED-FILES b/SHARED-FILES
index e6e29bcadc..033ce7f092 100644
--- a/SHARED-FILES
+++ b/SHARED-FILES
@@ -280,3 +280,11 @@ sysdeps/ieee754/flt-32/s_erfcf.c
(file src/binary32/erfc/erfcf.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
+sysdeps/ieee754/flt-32/e_lgammaf_r.c:
+ (file src/binary32/lgamma/lgammaf.c in CORE-MATH)
+ - change the function name from cr_lgammaf to __ieee754_lgammaf_r
+ - add "int *signgamp" as 2nd argument and add at the beginning:
+ if (signgamp != NULL) *signgamp = 1;
+ - remove the errno stuff (this is done by the wrapper)
+ - replace 0x1p127f * 0x1p127f by math_narrow_eval (x * 0x1p127f)
+ - add libm_alias_finite (__ieee754_lgammaf_r, __lgammaf_r) at the end
diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulps
index fc10f7f80d..1d3d1f9b6a 100644
--- a/sysdeps/aarch64/libm-test-ulps
+++ b/sysdeps/aarch64/libm-test-ulps
@@ -1288,22 +1288,18 @@ ldouble: 7
Function: "lgamma":
double: 3
-float: 4
ldouble: 5
Function: "lgamma_downward":
double: 4
-float: 4
ldouble: 8
Function: "lgamma_towardzero":
double: 4
-float: 3
ldouble: 5
Function: "lgamma_upward":
double: 4
-float: 5
ldouble: 8
Function: "log":
diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
index 3678bc38e3..7256e674bb 100644
--- a/sysdeps/alpha/fpu/libm-test-ulps
+++ b/sysdeps/alpha/fpu/libm-test-ulps
@@ -1134,22 +1134,18 @@ ldouble: 7
Function: "lgamma":
double: 4
-float: 7
ldouble: 5
Function: "lgamma_downward":
double: 5
-float: 7
ldouble: 8
Function: "lgamma_towardzero":
double: 5
-float: 6
ldouble: 5
Function: "lgamma_upward":
double: 5
-float: 6
ldouble: 8
Function: "log":
diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
index 68d67b6a67..66a2b541c6 100644
--- a/sysdeps/arc/fpu/libm-test-ulps
+++ b/sysdeps/arc/fpu/libm-test-ulps
@@ -917,19 +917,15 @@ float: 9
Function: "lgamma":
double: 7
-float: 6
Function: "lgamma_downward":
double: 6
-float: 5
Function: "lgamma_towardzero":
double: 7
-float: 6
Function: "lgamma_upward":
double: 7
-float: 6
Function: "log":
double: 1
diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps
index dc2499b56a..38836ddc38 100644
--- a/sysdeps/arc/nofpu/libm-test-ulps
+++ b/sysdeps/arc/nofpu/libm-test-ulps
@@ -223,7 +223,6 @@ float: 4
Function: "lgamma":
double: 4
-float: 7
Function: "log10":
double: 2
diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
index 000a5af492..2651046cfa 100644
--- a/sysdeps/arm/libm-test-ulps
+++ b/sysdeps/arm/libm-test-ulps
@@ -911,19 +911,15 @@ float: 5
Function: "lgamma":
double: 4
-float: 7
Function: "lgamma_downward":
double: 5
-float: 7
Function: "lgamma_towardzero":
double: 5
-float: 6
Function: "lgamma_upward":
double: 5
-float: 6
Function: "log":
float: 1
diff --git a/sysdeps/csky/fpu/libm-test-ulps b/sysdeps/csky/fpu/libm-test-ulps
index ed373cd353..02b4cb4934 100644
--- a/sysdeps/csky/fpu/libm-test-ulps
+++ b/sysdeps/csky/fpu/libm-test-ulps
@@ -875,19 +875,15 @@ float: 5
Function: "lgamma":
double: 4
-float: 7
Function: "lgamma_downward":
double: 5
-float: 7
Function: "lgamma_towardzero":
double: 5
-float: 6
Function: "lgamma_upward":
double: 5
-float: 6
Function: "log10":
double: 2
diff --git a/sysdeps/csky/nofpu/libm-test-ulps b/sysdeps/csky/nofpu/libm-test-ulps
index 48a8c7351f..34312f5a06 100644
--- a/sysdeps/csky/nofpu/libm-test-ulps
+++ b/sysdeps/csky/nofpu/libm-test-ulps
@@ -873,19 +873,15 @@ float: 5
Function: "lgamma":
double: 4
-float: 7
Function: "lgamma_downward":
double: 5
-float: 4
Function: "lgamma_towardzero":
double: 5
-float: 4
Function: "lgamma_upward":
double: 5
-float: 5
Function: "log":
float: 1
diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
index 19087298e9..47bdd48e7f 100644
--- a/sysdeps/hppa/fpu/libm-test-ulps
+++ b/sysdeps/hppa/fpu/libm-test-ulps
@@ -931,20 +931,16 @@ float: 5
Function: "lgamma":
double: 4
-float: 7
ldouble: 1
Function: "lgamma_downward":
double: 5
-float: 7
Function: "lgamma_towardzero":
double: 5
-float: 6
Function: "lgamma_upward":
double: 5
-float: 6
Function: "log":
double: 1
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 5284078bee..170e7cfc65 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -1354,25 +1354,21 @@ ldouble: 5
Function: "lgamma":
double: 4
-float: 5
float128: 5
ldouble: 4
Function: "lgamma_downward":
double: 5
-float: 5
float128: 8
ldouble: 7
Function: "lgamma_towardzero":
double: 5
-float: 6
float128: 5
ldouble: 7
Function: "lgamma_upward":
double: 5
-float: 6
float128: 8
ldouble: 6
diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
index da00d80ba7..a9ce632e6a 100644
--- a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
+++ b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
@@ -1357,7 +1357,6 @@ ldouble: 5
Function: "lgamma":
double: 4
-float: 5
float128: 5
ldouble: 4
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..cb65513056 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -1,247 +1,367 @@
-/* e_lgammaf_r.c -- float version of e_lgamma_r.c.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+/* Correctly-rounded logarithm of the absolute value of the gamma function
+ for binary32 value.
+Copyright (c) 2023, 2024 Alexei Sibidanov.
+
+This file is part of the CORE-MATH project
+project (file src/binary32/lgamma/lgammaf.c, revision bc385c2).
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+/* Changes with respect to the original CORE-MATH code:
+ - removed the dealing with errno
+ (this is done in the wrapper math/w_lgammaf_compat2.c).
+ - usage of math_narrow_eval to deal with underflow/overflow.
+ - deal with signamp. */
+
+#include <array_length.h>
+#include <stdint.h>
#include <math.h>
-#include <math-narrow-eval.h>
-#include <math_private.h>
-#include <libc-diag.h>
#include <libm-alias-finite.h>
+#include <limits.h>
+#include <math-narrow-eval.h>
+#include "math_config.h"
-static const float
-two23= 8.3886080000e+06, /* 0x4b000000 */
-half= 5.0000000000e-01, /* 0x3f000000 */
-one = 1.0000000000e+00, /* 0x3f800000 */
-pi = 3.1415927410e+00, /* 0x40490fdb */
-a0 = 7.7215664089e-02, /* 0x3d9e233f */
-a1 = 3.2246702909e-01, /* 0x3ea51a66 */
-a2 = 6.7352302372e-02, /* 0x3d89f001 */
-a3 = 2.0580807701e-02, /* 0x3ca89915 */
-a4 = 7.3855509982e-03, /* 0x3bf2027e */
-a5 = 2.8905137442e-03, /* 0x3b3d6ec6 */
-a6 = 1.1927076848e-03, /* 0x3a9c54a1 */
-a7 = 5.1006977446e-04, /* 0x3a05b634 */
-a8 = 2.2086278477e-04, /* 0x39679767 */
-a9 = 1.0801156895e-04, /* 0x38e28445 */
-a10 = 2.5214456400e-05, /* 0x37d383a2 */
-a11 = 4.4864096708e-05, /* 0x383c2c75 */
-tc = 1.4616321325e+00, /* 0x3fbb16c3 */
-tf = -1.2148628384e-01, /* 0xbdf8cdcd */
-/* tt = -(tail of tf) */
-tt = 6.6971006518e-09, /* 0x31e61c52 */
-t0 = 4.8383611441e-01, /* 0x3ef7b95e */
-t1 = -1.4758771658e-01, /* 0xbe17213c */
-t2 = 6.4624942839e-02, /* 0x3d845a15 */
-t3 = -3.2788541168e-02, /* 0xbd064d47 */
-t4 = 1.7970675603e-02, /* 0x3c93373d */
-t5 = -1.0314224288e-02, /* 0xbc28fcfe */
-t6 = 6.1005386524e-03, /* 0x3bc7e707 */
-t7 = -3.6845202558e-03, /* 0xbb7177fe */
-t8 = 2.2596477065e-03, /* 0x3b141699 */
-t9 = -1.4034647029e-03, /* 0xbab7f476 */
-t10 = 8.8108185446e-04, /* 0x3a66f867 */
-t11 = -5.3859531181e-04, /* 0xba0d3085 */
-t12 = 3.1563205994e-04, /* 0x39a57b6b */
-t13 = -3.1275415677e-04, /* 0xb9a3f927 */
-t14 = 3.3552918467e-04, /* 0x39afe9f7 */
-u0 = -7.7215664089e-02, /* 0xbd9e233f */
-u1 = 6.3282704353e-01, /* 0x3f2200f4 */
-u2 = 1.4549225569e+00, /* 0x3fba3ae7 */
-u3 = 9.7771751881e-01, /* 0x3f7a4bb2 */
-u4 = 2.2896373272e-01, /* 0x3e6a7578 */
-u5 = 1.3381091878e-02, /* 0x3c5b3c5e */
-v1 = 2.4559779167e+00, /* 0x401d2ebe */
-v2 = 2.1284897327e+00, /* 0x4008392d */
-v3 = 7.6928514242e-01, /* 0x3f44efdf */
-v4 = 1.0422264785e-01, /* 0x3dd572af */
-v5 = 3.2170924824e-03, /* 0x3b52d5db */
-s0 = -7.7215664089e-02, /* 0xbd9e233f */
-s1 = 2.1498242021e-01, /* 0x3e5c245a */
-s2 = 3.2577878237e-01, /* 0x3ea6cc7a */
-s3 = 1.4635047317e-01, /* 0x3e15dce6 */
-s4 = 2.6642270386e-02, /* 0x3cda40e4 */
-s5 = 1.8402845599e-03, /* 0x3af135b4 */
-s6 = 3.1947532989e-05, /* 0x3805ff67 */
-r1 = 1.3920053244e+00, /* 0x3fb22d3b */
-r2 = 7.2193557024e-01, /* 0x3f38d0c5 */
-r3 = 1.7193385959e-01, /* 0x3e300f6e */
-r4 = 1.8645919859e-02, /* 0x3c98bf54 */
-r5 = 7.7794247773e-04, /* 0x3a4beed6 */
-r6 = 7.3266842264e-06, /* 0x36f5d7bd */
-w0 = 4.1893854737e-01, /* 0x3ed67f1d */
-w1 = 8.3333335817e-02, /* 0x3daaaaab */
-w2 = -2.7777778450e-03, /* 0xbb360b61 */
-w3 = 7.9365057172e-04, /* 0x3a500cfd */
-w4 = -5.9518753551e-04, /* 0xba1c065c */
-w5 = 8.3633989561e-04, /* 0x3a5b3dd2 */
-w6 = -1.6309292987e-03; /* 0xbad5c4e8 */
-
-static const float zero= 0.0000000000e+00;
-
-static float
-sin_pif(float x)
+static double
+as_r7 (double x, const double *c)
{
- float y,z;
- int n,ix;
-
- GET_FLOAT_WORD(ix,x);
- ix &= 0x7fffffff;
-
- if(ix<0x3e800000) return __sinf (pi*x);
- y = -x; /* x is assume negative */
-
- /*
- * argument reduction, make sure inexact flag not raised if input
- * is an integer
- */
- z = floorf(y);
- if(z!=y) { /* inexact anyway */
- y *= (float)0.5;
- y = (float)2.0*(y - floorf(y)); /* y = |x| mod 2.0 */
- n = (int) (y*(float)4.0);
- } else {
- if(ix>=0x4b800000) {
- y = zero; n = 0; /* y must be even */
- } else {
- if(ix<0x4b000000) z = y+two23; /* exact */
- GET_FLOAT_WORD(n,z);
- n &= 1;
- y = n;
- n<<= 2;
- }
- }
- switch (n) {
- case 0: y = __sinf (pi*y); break;
- case 1:
- case 2: y = __cosf (pi*((float)0.5-y)); break;
- case 3:
- case 4: y = __sinf (pi*(one-y)); break;
- case 5:
- case 6: y = -__cosf (pi*(y-(float)1.5)); break;
- default: y = __sinf (pi*(y-(float)2.0)); break;
- }
- return -y;
+ return (((x - c[0]) * (x - c[1])) * ((x - c[2]) * (x - c[3])))
+ * (((x - c[4]) * (x - c[5])) * ((x - c[6])));
}
+static double
+as_r8 (double x, const double *c)
+{
+ return (((x - c[0]) * (x - c[1])) * ((x - c[2]) * (x - c[3])))
+ * (((x - c[4]) * (x - c[5])) * ((x - c[6]) * (x - c[7])));
+}
+
+static double
+as_sinpi (double x)
+{
+ static const double c[] =
+ {
+ 0x1p+2, -0x1.de9e64df22ea4p+1, 0x1.472be122401f8p+0,
+ -0x1.d4fcd82df91bp-3, 0x1.9f05c97e0aab2p-6, -0x1.f3091c427b611p-10,
+ 0x1.b22c9bfdca547p-14, -0x1.15484325ef569p-18
+ };
+ x -= 0.5;
+ double x2 = x * x, x4 = x2 * x2, x8 = x4 * x4;
+ return (0.25 - x2)
+ * ((c[0] + x2 * c[1]) + x4 * (c[2] + x2 * c[3])
+ + x8 * ((c[4] + x2 * c[5]) + x4 * (c[6] + x2 * c[7])));
+}
+
+static double
+as_ln (double x)
+{
+ uint64_t t = asuint64 (x);
+ int e = (t >> 52) - 0x3ff;
+ static const double c[] =
+ {
+ 0x1.fffffffffff24p-1, -0x1.ffffffffd1d67p-2, 0x1.55555537802dep-2,
+ -0x1.ffffeca81b866p-3, 0x1.999611761d772p-3, -0x1.54f3e581b61bfp-3,
+ 0x1.1e642b4cb5143p-3, -0x1.9115a5af1e1edp-4
+ };
+ static const double il[] =
+ {
+ 0x1.59caeec280116p-57, 0x1.f0a30c01162aap-5, 0x1.e27076e2af2ebp-4,
+ 0x1.5ff3070a793d6p-3, 0x1.c8ff7c79a9a2p-3, 0x1.1675cababa60fp-2,
+ 0x1.4618bc21c5ec2p-2, 0x1.739d7f6bbd007p-2, 0x1.9f323ecbf984dp-2,
+ 0x1.c8ff7c79a9a21p-2, 0x1.f128f5faf06ecp-2, 0x1.0be72e4252a83p-1,
+ 0x1.1e85f5e7040d1p-1, 0x1.307d7334f10bep-1, 0x1.41d8fe84672afp-1,
+ 0x1.52a2d265bc5abp-1
+ };
+ static const double ix[] =
+ {
+ 0x1p+0, 0x1.e1e1e1e1e1e1ep-1, 0x1.c71c71c71c71cp-1,
+ 0x1.af286bca1af28p-1, 0x1.999999999999ap-1, 0x1.8618618618618p-1,
+ 0x1.745d1745d1746p-1, 0x1.642c8590b2164p-1, 0x1.5555555555555p-1,
+ 0x1.47ae147ae147bp-1, 0x1.3b13b13b13b14p-1, 0x1.2f684bda12f68p-1,
+ 0x1.2492492492492p-1, 0x1.1a7b9611a7b96p-1, 0x1.1111111111111p-1,
+ 0x1.0842108421084p-1
+ };
+ int i = (t >> 48) & 0xf;
+ t = (t & (~UINT64_C(0) >> 12)) | (INT64_C(0x3ff) << 52);
+ double z = ix[i] * asdouble (t) - 1;
+ double z2 = z * z, z4 = z2 * z2;
+ return e * 0x1.62e42fefa39efp-1 + il[i]
+ + z * ((c[0] + z * c[1]) + z2 * (c[2] + z * c[3])
+ + z4 * ((c[4] + z * c[5]) + z2 * (c[6] + z * c[7])));
+}
float
-__ieee754_lgammaf_r(float x, int *signgamp)
+__ieee754_lgammaf_r (float x, int *signgamp)
{
- float t,y,z,nadj,p,p1,p2,p3,q,r,w;
- int i,hx,ix;
-
- GET_FLOAT_WORD(hx,x);
-
- /* purge off +-inf, NaN, +-0, and negative arguments */
- *signgamp = 1;
- ix = hx&0x7fffffff;
- if(__builtin_expect(ix>=0x7f800000, 0)) return x*x;
- if(__builtin_expect(ix==0, 0))
- {
- if (hx < 0)
- *signgamp = -1;
- return one/fabsf(x);
- }
- if(__builtin_expect(ix<0x30800000, 0)) {
- /* |x|<2**-30, return -log(|x|) */
- if(hx<0) {
- *signgamp = -1;
- return -__ieee754_logf(-x);
- } else return -__ieee754_logf(x);
+ static const struct
+ {
+ float x;
+ float f;
+ float df;
+ } tb[] = {
+ { -0x1.efc2a2p+14, -0x1.222dbcp+18, -0x1p-7 },
+ { -0x1.627346p+7, -0x1.73235ep+9, -0x1p-16 },
+ { -0x1.08b14p+4, -0x1.f0cbe6p+4, -0x1p-21 },
+ { -0x1.69d628p+3, -0x1.0eac2ap+4, -0x1p-21 },
+ { -0x1.904902p+2, -0x1.65532cp+2, 0x1p-23 },
+ { -0x1.9272d2p+1, -0x1.170b98p-8, 0x1p-33 },
+ { -0x1.625edap+1, 0x1.6a6c4ap-5, -0x1p-30 },
+ { -0x1.5fc2aep+1, 0x1.c0a484p-11, -0x1p-36 },
+ { -0x1.5fb43ep+1, 0x1.5b697p-17, 0x1p-42 },
+ { -0x1.5fa20cp+1, -0x1.132f7ap-10, 0x1p-35 },
+ { -0x1.580c1ep+1, -0x1.5787c6p-4, 0x1p-29 },
+ { -0x1.3a7fcap+1, -0x1.e4cf24p-24, -0x1p-49 },
+ { -0x1.c2f04p-30, 0x1.43a6f6p+4, 0x1p-21 },
+ { -0x1.ade594p-30, 0x1.446ab2p+4, -0x1p-21 },
+ { -0x1.437e74p-40, 0x1.b7dec2p+4, -0x1p-21 },
+ { -0x1.d85bfep-43, 0x1.d31592p+4, -0x1p-21 },
+ { -0x1.f51c8ep-49, 0x1.0a572ap+5, -0x1p-20 },
+ { -0x1.108a5ap-66, 0x1.6d7b18p+5, -0x1p-20 },
+ { -0x1.ecf3fep-73, 0x1.8f8e5ap+5, -0x1p-20 },
+ { -0x1.25cb66p-123, 0x1.547a44p+6, -0x1p-19 },
+ { 0x1.ecf3fep-73, 0x1.8f8e5ap+5, -0x1p-20 },
+ { 0x1.108a5ap-66, 0x1.6d7b18p+5, -0x1p-20 },
+ { 0x1.a68bbcp-42, 0x1.c9c6e8p+4, 0x1p-21 },
+ { 0x1.ddfd06p-12, 0x1.ec5ba8p+2, -0x1p-23 },
+ { 0x1.f8a754p-9, 0x1.63acc2p+2, 0x1p-23 },
+ { 0x1.8d16b2p+5, 0x1.1e4b4ep+7, 0x1p-18 },
+ { 0x1.359e0ep+10, 0x1.d9ad02p+12, -0x1p-13 },
+ { 0x1.a82a2cp+13, 0x1.c38036p+16, 0x1p-9 },
+ { 0x1.62c646p+14, 0x1.9075bep+17, -0x1p-8 },
+ { 0x1.7f298p+31, 0x1.f44946p+35, -0x1p+10 },
+ { 0x1.a45ea4p+33, 0x1.25dcbcp+38, -0x1p+13 },
+ { 0x1.f9413ep+76, 0x1.9d5ab4p+82, -0x1p+57 },
+ { 0x1.dcbbaap+99, 0x1.fc5772p+105, 0x1p+80 },
+ { 0x1.58ace8p+112, 0x1.9e4f66p+118, -0x1p+93 },
+ { 0x1.87bdfp+115, 0x1.e465aep+121, 0x1p+96 },
+ };
+
+ float fx = floor (x);
+ float ax = fabsf (x);
+ uint32_t t = asuint (ax);
+ if (__glibc_unlikely (t >= (0xffu << 23)))
+ {
+ *signgamp = 1;
+ if (t == (0xffu << 23))
+ return INFINITY;
+ return x + x; /* nan */
+ }
+ if (__glibc_unlikely (fx == x))
+ {
+ if (x <= 0.0f)
+ {
+ *signgamp = asuint (x) >> 31 ? -1 : 1;
+ return 1.0f / 0.0f;
}
- if(hx<0) {
- if(ix>=0x4b000000) /* |x|>=2**23, must be -integer */
- return fabsf (x)/zero;
- if (ix > 0x40000000 /* X < 2.0f. */
- && ix < 0x41700000 /* X > -15.0f. */)
- return __lgamma_negf (x, signgamp);
- t = sin_pif(x);
- if(t==zero) return one/fabsf(t); /* -integer */
- nadj = __ieee754_logf(pi/fabsf(t*x));
- if(t<zero) *signgamp = -1;
- x = -x;
+ if (x == 1.0f || x == 2.0f)
+ {
+ *signgamp = 1;
+ return 0.0f;
}
+ }
+
+ /* Check the value of fx to avoid a spurious invalid exception.
+ Note that for a binary32 |x| >= 2^23, x is necessarily an integer,
+ and we already dealed with negative integers, thus now:
+ -2^23 < x < +Inf and x is not a negative integer nor 0, 1, 2. */
+ int k;
+ if (__builtin_expect (fx >= 0x1p31f, 0))
+ k = INT_MAX;
+ else
+ k = fx;
+ *signgamp = 1 - (((k & (k >> 31)) & 1) << 1);
- /* purge off 1 and 2 */
- if (ix==0x3f800000||ix==0x40000000) r = 0;
- /* for x < 2.0 */
- else if(ix<0x40000000) {
- if(ix<=0x3f666666) { /* lgamma(x) = lgamma(x+1)-log(x) */
- r = -__ieee754_logf(x);
- if(ix>=0x3f3b4a20) {y = one-x; i= 0;}
- else if(ix>=0x3e6d3308) {y= x-(tc-one); i=1;}
- else {y = x; i=2;}
- } else {
- r = zero;
- if(ix>=0x3fdda618) {y=(float)2.0-x;i=0;} /* [1.7316,2] */
- else if(ix>=0x3F9da620) {y=x-tc;i=1;} /* [1.23,1.73] */
- else {y=x-one;i=2;}
+ double z = ax, f;
+ if (__glibc_unlikely (ax < 0x1.52p-1f))
+ {
+ static const double rn[] =
+ {
+ -0x1.505bdf4b65acp+4, -0x1.51c80eb47e068p+2,
+ 0x1.0000000007cb8p+0, -0x1.4ac529250a1fcp+1,
+ -0x1.a8c99dbe1621ap+0, -0x1.4abdcc74115eap+0,
+ -0x1.1b87fe5a5b923p+0, -0x1.05b8a4d47ff64p+0
+ };
+ const double c0 = 0x1.0fc0fad268c4dp+2;
+ static const double rd[] =
+ {
+ -0x1.4db2cfe9a5265p+5, -0x1.062e99d1c4f27p+3,
+ -0x1.c81bc2ecf25f6p+1, -0x1.108e55c10091bp+1,
+ -0x1.7dd25af0b83d4p+0, -0x1.36bf1880125fcp+0,
+ -0x1.1379fc8023d9cp+0, -0x1.03712e41525d2p+0
+ };
+ double s = x;
+ f = (c0 * s) * as_r8 (s, rn) / as_r8 (s, rd) - as_ln (z);
+ }
+ else
+ {
+ if (ax > 0x1.afc1ap+1f)
+ {
+ if (__glibc_unlikely (x > 0x1.895f1cp+121f))
+ return math_narrow_eval (0x1p127f * 0x1p127f);
+ /* |x|>=2**23, must be -integer */
+ if (__glibc_unlikely (x < 0.0f && ax > 0x1p+23))
+ return ax / 0.0f;
+ double lz = as_ln (z);
+ f = (z - 0.5) * (lz - 1) + 0x1.acfe390c97d69p-2;
+ if (ax < 0x1.0p+20f)
+ {
+ double iz = 1.0 / z, iz2 = iz * iz;
+ if (ax > 1198.0f)
+ f += iz * (1. / 12.);
+ else if (ax > 0x1.279a7p+6f)
+ {
+ static const double c[] =
+ {
+ 0x1.555555547fbadp-4, -0x1.6c0fd270c465p-9
+ };
+ f += iz * (c[0] + iz2 * c[1]);
+ }
+ else if (ax > 0x1.555556p+3f)
+ {
+ static const double c[] =
+ {
+ 0x1.555555554de0bp-4, -0x1.6c16bdc45944fp-9,
+ 0x1.a0077f300ecb3p-11, -0x1.2e9cfff3b29c2p-11
+ };
+ double iz4 = iz2 * iz2;
+ f += iz * ((c[0] + iz2 * c[1]) + iz4 * (c[2] + iz2 * c[3]));
+ }
+ else
+ {
+ static const double c[] =
+ {
+ 0x1.5555555551286p-4, -0x1.6c16c0e7c4cf4p-9,
+ 0x1.a0193267fe6f2p-11, -0x1.37e87ec19cb45p-11,
+ 0x1.b40011dfff081p-11, -0x1.c16c8946b19b6p-10,
+ 0x1.e9f47ace150d8p-9, -0x1.4f5843a71a338p-8
+ };
+ double iz4 = iz2 * iz2, iz8 = iz4 * iz4;
+ double p = ((c[0] + iz2 * c[1]) + iz4 * (c[2] + iz2 * c[3]))
+ + iz8 * ((c[4] + iz2 * c[5])
+ + iz4 * (c[6] + iz2 * c[7]));
+ f += iz * p;
+ }
}
- switch(i) {
- case 0:
- z = y*y;
- p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10))));
- p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11)))));
- p = y*p1+p2;
- r += (p-(float)0.5*y); break;
- case 1:
- z = y*y;
- w = z*y;
- p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */
- p2 = t1+w*(t4+w*(t7+w*(t10+w*t13)));
- p3 = t2+w*(t5+w*(t8+w*(t11+w*t14)));
- p = z*p1-(tt-w*(p2+y*p3));
- r += (tf + p); break;
- case 2:
- p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5)))));
- p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5))));
- r += (-(float)0.5*y + p1/p2);
+ if (x < 0.0f)
+ {
+ f = 0x1.250d048e7a1bdp+0 - f - lz;
+ double lp = as_ln (as_sinpi (x - fx));
+ f -= lp;
}
}
- else if(ix<0x41000000) { /* x < 8.0 */
- i = (int)x;
- t = zero;
- y = x-(float)i;
- p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6))))));
- q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6)))));
- r = half*y+p/q;
- z = one; /* lgamma(1+s) = log(s) + lgamma(s) */
- switch(i) {
- case 7: z *= (y+(float)6.0); /* FALLTHRU */
- case 6: z *= (y+(float)5.0); /* FALLTHRU */
- case 5: z *= (y+(float)4.0); /* FALLTHRU */
- case 4: z *= (y+(float)3.0); /* FALLTHRU */
- case 3: z *= (y+(float)2.0); /* FALLTHRU */
- r += __ieee754_logf(z); break;
+ else
+ {
+ static const double rn[] =
+ {
+ -0x1.667923ff14df7p+5, -0x1.2d35f25ad8f64p+3,
+ -0x1.b8c9eab9d5bd3p+1, -0x1.7a4a97f494127p+0,
+ -0x1.3a6c8295b4445p-1, -0x1.da44e8b810024p-3,
+ -0x1.9061e81c77e4ap-5
+ };
+ if (x < 0.0f)
+ {
+ int ni = floorf (-2 * x);
+ if ((ni & 1) == 0 && ni == -2 * x)
+ return 1.0f / 0.0f;
+ }
+ const double c0 = 0x1.3cc0e6a0106b3p+2;
+ static const double rd[] =
+ {
+ -0x1.491a899e84c52p+6, -0x1.d202961b9e098p+3,
+ -0x1.4ced68c631ed6p+2, -0x1.2589eedf40738p+1,
+ -0x1.1302e3337271p+0, -0x1.c36b802f26dffp-2,
+ -0x1.3ded448acc39dp-3, -0x1.bffc491078eafp-6
+ };
+ f = (z - 1) * (z - 2) * c0 * as_r7 (z, rn) / as_r8 (z, rd);
+ if (x < 0.0f)
+ {
+ if (__glibc_unlikely (t < 0x40301b93u && t > 0x402f95c2u))
+ {
+ double h = (x + 0x1.5fb410a1bd901p+1)
+ - 0x1.a19a96d2e6f85p-54;
+ double h2 = h * h;
+ double h4 = h2 * h2;
+ static const double c[] =
+ {
+ -0x1.ea12da904b18cp+0, 0x1.3267f3c265a54p+3,
+ -0x1.4185ac30cadb3p+4, 0x1.f504accc3f2e4p+5,
+ -0x1.8588444c679b4p+7, 0x1.43740491dc22p+9,
+ -0x1.12400ea23f9e6p+11, 0x1.dac829f365795p+12
+ };
+ f = h * ((c[0] + h * c[1]) + h2 * (c[2] + h * c[3])
+ + h4 * ((c[4] + h * c[5]) + h2 * (c[6] + h * c[7])));
+ }
+ else if (__glibc_unlikely (t > 0x401ceccbu && t < 0x401d95cau))
+ {
+ double h = (x + 0x1.3a7fc9600f86cp+1)
+ + 0x1.55f64f98af8dp-55;
+ double h2 = h * h;
+ double h4 = h2 * h2;
+ static const double c[] =
+ {
+ 0x1.83fe966af535fp+0, 0x1.36eebb002f61ap+2,
+ 0x1.694a60589a0b3p+0, 0x1.1718d7aedb0b5p+3,
+ 0x1.733a045eca0d3p+2, 0x1.8d4297421205bp+4,
+ 0x1.7feea5fb29965p+4
+ };
+ f = h
+ * ((c[0] + h * c[1]) + h2 * (c[2] + h * c[3])
+ + h4 * ((c[4] + h * c[5]) + h2 * (c[6])));
+ }
+ else if (__glibc_unlikely (t > 0x40492009u && t < 0x404940efu))
+ {
+ double h = (x + 0x1.9260dbc9e59afp+1)
+ + 0x1.f717cd335a7b3p-53;
+ double h2 = h * h;
+ double h4 = h2 * h2;
+ static const double c[] =
+ {
+ 0x1.f20a65f2fac55p+2, 0x1.9d4d297715105p+4,
+ 0x1.c1137124d5b21p+6, 0x1.267203d24de38p+9,
+ 0x1.99a63399a0b44p+11, 0x1.2941214faaf0cp+14,
+ 0x1.bb912c0c9cdd1p+16
+ };
+ f = h * ((c[0] + h * c[1]) + h2 * (c[2] + h * c[3])
+ + h4 * ((c[4] + h * c[5]) + h2 * (c[6])));
+ }
+ else
+ {
+ f = 0x1.250d048e7a1bdp+0 - f;
+ double lp = as_ln (as_sinpi (x - fx) * z);
+ f -= lp;
+ }
}
- /* 8.0 <= x < 2**26 */
- } else if (ix < 0x4c800000) {
- t = __ieee754_logf(x);
- z = one/x;
- y = z*z;
- w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6)))));
- r = (x-half)*(t-one)+w;
- } else
- /* 2**26 <= x <= inf */
- r = math_narrow_eval (x*(__ieee754_logf(x)-one));
- /* NADJ is set for negative arguments but not otherwise,
- resulting in warnings that it may be used uninitialized
- although in the cases where it is used it has always been
- set. */
- DIAG_PUSH_NEEDS_COMMENT;
- DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
- if(hx<0) r = nadj - r;
- DIAG_POP_NEEDS_COMMENT;
- return r;
+ }
+ }
+
+ uint64_t tl = (asuint64 (f) + 5) & 0xfffffff;
+ float r = f;
+ if (__glibc_unlikely (tl <= 31u))
+ {
+ t = asuint (x);
+ for (unsigned i = 0; i < array_length (tb); i++)
+ {
+ if (t == asuint (tb[i].x))
+ return tb[i].f + tb[i].df;
+ }
+ }
+ return r;
}
libm_alias_finite (__ieee754_lgammaf_r, __lgammaf_r)
diff --git a/sysdeps/ieee754/flt-32/lgamma_negf.c b/sysdeps/ieee754/flt-32/lgamma_negf.c
index a8aa74eca9..1cc8931700 100644
--- a/sysdeps/ieee754/flt-32/lgamma_negf.c
+++ b/sysdeps/ieee754/flt-32/lgamma_negf.c
@@ -1,282 +1 @@
-/* lgammaf expanding around zeros.
- Copyright (C) 2015-2024 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <float.h>
-#include <math.h>
-#include <math-narrow-eval.h>
-#include <math_private.h>
-#include <fenv_private.h>
-
-static const float lgamma_zeros[][2] =
- {
- { -0x2.74ff94p+0f, 0x1.3fe0f2p-24f },
- { -0x2.bf682p+0f, -0x1.437b2p-24f },
- { -0x3.24c1b8p+0f, 0x6.c34cap-28f },
- { -0x3.f48e2cp+0f, 0x1.707a04p-24f },
- { -0x4.0a13ap+0f, 0x1.e99aap-24f },
- { -0x4.fdd5ep+0f, 0x1.64454p-24f },
- { -0x5.021a98p+0f, 0x2.03d248p-24f },
- { -0x5.ffa4cp+0f, 0x2.9b82fcp-24f },
- { -0x6.005ac8p+0f, -0x1.625f24p-24f },
- { -0x6.fff3p+0f, 0x2.251e44p-24f },
- { -0x7.000dp+0f, 0x8.48078p-28f },
- { -0x7.fffe6p+0f, 0x1.fa98c4p-28f },
- { -0x8.0001ap+0f, -0x1.459fcap-28f },
- { -0x8.ffffdp+0f, -0x1.c425e8p-24f },
- { -0x9.00003p+0f, 0x1.c44b82p-24f },
- { -0xap+0f, 0x4.9f942p-24f },
- { -0xap+0f, -0x4.9f93b8p-24f },
- { -0xbp+0f, 0x6.b9916p-28f },
- { -0xbp+0f, -0x6.b9915p-28f },
- { -0xcp+0f, 0x8.f76c8p-32f },
- { -0xcp+0f, -0x8.f76c7p-32f },
- { -0xdp+0f, 0xb.09231p-36f },
- { -0xdp+0f, -0xb.09231p-36f },
- { -0xep+0f, 0xc.9cba5p-40f },
- { -0xep+0f, -0xc.9cba5p-40f },
- { -0xfp+0f, 0xd.73f9fp-44f },
- };
-
-static const float e_hi = 0x2.b7e15p+0f, e_lo = 0x1.628aeep-24f;
-
-/* Coefficients B_2k / 2k(2k-1) of x^-(2k-1) in Stirling's
- approximation to lgamma function. */
-
-static const float lgamma_coeff[] =
- {
- 0x1.555556p-4f,
- -0xb.60b61p-12f,
- 0x3.403404p-12f,
- };
-
-#define NCOEFF (sizeof (lgamma_coeff) / sizeof (lgamma_coeff[0]))
-
-/* Polynomial approximations to (|gamma(x)|-1)(x-n)/(x-x0), where n is
- the integer end-point of the half-integer interval containing x and
- x0 is the zero of lgamma in that half-integer interval. Each
- polynomial is expressed in terms of x-xm, where xm is the midpoint
- of the interval for which the polynomial applies. */
-
-static const float poly_coeff[] =
- {
- /* Interval [-2.125, -2] (polynomial degree 5). */
- -0x1.0b71c6p+0f,
- -0xc.73a1ep-4f,
- -0x1.ec8462p-4f,
- -0xe.37b93p-4f,
- -0x1.02ed36p-4f,
- -0xe.cbe26p-4f,
- /* Interval [-2.25, -2.125] (polynomial degree 5). */
- -0xf.29309p-4f,
- -0xc.a5cfep-4f,
- 0x3.9c93fcp-4f,
- -0x1.02a2fp+0f,
- 0x9.896bep-4f,
- -0x1.519704p+0f,
- /* Interval [-2.375, -2.25] (polynomial degree 5). */
- -0xd.7d28dp-4f,
- -0xe.6964cp-4f,
- 0xb.0d4f1p-4f,
- -0x1.9240aep+0f,
- 0x1.dadabap+0f,
- -0x3.1778c4p+0f,
- /* Interval [-2.5, -2.375] (polynomial degree 6). */
- -0xb.74ea2p-4f,
- -0x1.2a82cp+0f,
- 0x1.880234p+0f,
- -0x3.320c4p+0f,
- 0x5.572a38p+0f,
- -0x9.f92bap+0f,
- 0x1.1c347ep+4f,
- /* Interval [-2.625, -2.5] (polynomial degree 6). */
- -0x3.d10108p-4f,
- 0x1.cd5584p+0f,
- 0x3.819c24p+0f,
- 0x6.84cbb8p+0f,
- 0xb.bf269p+0f,
- 0x1.57fb12p+4f,
- 0x2.7b9854p+4f,
- /* Interval [-2.75, -2.625] (polynomial degree 6). */
- -0x6.b5d25p-4f,
- 0x1.28d604p+0f,
- 0x1.db6526p+0f,
- 0x2.e20b38p+0f,
- 0x4.44c378p+0f,
- 0x6.62a08p+0f,
- 0x9.6db3ap+0f,
- /* Interval [-2.875, -2.75] (polynomial degree 5). */
- -0x8.a41b2p-4f,
- 0xc.da87fp-4f,
- 0x1.147312p+0f,
- 0x1.7617dap+0f,
- 0x1.d6c13p+0f,
- 0x2.57a358p+0f,
- /* Interval [-3, -2.875] (polynomial degree 5). */
- -0xa.046d6p-4f,
- 0x9.70b89p-4f,
- 0xa.a89a6p-4f,
- 0xd.2f2d8p-4f,
- 0xd.e32b4p-4f,
- 0xf.fb741p-4f,
- };
-
-static const size_t poly_deg[] =
- {
- 5,
- 5,
- 5,
- 6,
- 6,
- 6,
- 5,
- 5,
- };
-
-static const size_t poly_end[] =
- {
- 5,
- 11,
- 17,
- 24,
- 31,
- 38,
- 44,
- 50,
- };
-
-/* Compute sin (pi * X) for -0.25 <= X <= 0.5. */
-
-static float
-lg_sinpi (float x)
-{
- if (x <= 0.25f)
- return __sinf (M_PIf * x);
- else
- return __cosf (M_PIf * (0.5f - x));
-}
-
-/* Compute cos (pi * X) for -0.25 <= X <= 0.5. */
-
-static float
-lg_cospi (float x)
-{
- if (x <= 0.25f)
- return __cosf (M_PIf * x);
- else
- return __sinf (M_PIf * (0.5f - x));
-}
-
-/* Compute cot (pi * X) for -0.25 <= X <= 0.5. */
-
-static float
-lg_cotpi (float x)
-{
- return lg_cospi (x) / lg_sinpi (x);
-}
-
-/* Compute lgamma of a negative argument -15 < X < -2, setting
- *SIGNGAMP accordingly. */
-
-float
-__lgamma_negf (float x, int *signgamp)
-{
- /* Determine the half-integer region X lies in, handle exact
- integers and determine the sign of the result. */
- int i = floorf (-2 * x);
- if ((i & 1) == 0 && i == -2 * x)
- return 1.0f / 0.0f;
- float xn = ((i & 1) == 0 ? -i / 2 : (-i - 1) / 2);
- i -= 4;
- *signgamp = ((i & 2) == 0 ? -1 : 1);
-
- SET_RESTORE_ROUNDF (FE_TONEAREST);
-
- /* Expand around the zero X0 = X0_HI + X0_LO. */
- float x0_hi = lgamma_zeros[i][0], x0_lo = lgamma_zeros[i][1];
- float xdiff = x - x0_hi - x0_lo;
-
- /* For arguments in the range -3 to -2, use polynomial
- approximations to an adjusted version of the gamma function. */
- if (i < 2)
- {
- int j = floorf (-8 * x) - 16;
- float xm = (-33 - 2 * j) * 0.0625f;
- float x_adj = x - xm;
- size_t deg = poly_deg[j];
- size_t end = poly_end[j];
- float g = poly_coeff[end];
- for (size_t j = 1; j <= deg; j++)
- g = g * x_adj + poly_coeff[end - j];
- return __log1pf (g * xdiff / (x - xn));
- }
-
- /* The result we want is log (sinpi (X0) / sinpi (X))
- + log (gamma (1 - X0) / gamma (1 - X)). */
- float x_idiff = fabsf (xn - x), x0_idiff = fabsf (xn - x0_hi - x0_lo);
- float log_sinpi_ratio;
- if (x0_idiff < x_idiff * 0.5f)
- /* Use log not log1p to avoid inaccuracy from log1p of arguments
- close to -1. */
- log_sinpi_ratio = __ieee754_logf (lg_sinpi (x0_idiff)
- / lg_sinpi (x_idiff));
- else
- {
- /* Use log1p not log to avoid inaccuracy from log of arguments
- close to 1. X0DIFF2 has positive sign if X0 is further from
- XN than X is from XN, negative sign otherwise. */
- float x0diff2 = ((i & 1) == 0 ? xdiff : -xdiff) * 0.5f;
- float sx0d2 = lg_sinpi (x0diff2);
- float cx0d2 = lg_cospi (x0diff2);
- log_sinpi_ratio = __log1pf (2 * sx0d2
- * (-sx0d2 + cx0d2 * lg_cotpi (x_idiff)));
- }
-
- float log_gamma_ratio;
- float y0 = math_narrow_eval (1 - x0_hi);
- float y0_eps = -x0_hi + (1 - y0) - x0_lo;
- float y = math_narrow_eval (1 - x);
- float y_eps = -x + (1 - y);
- /* We now wish to compute LOG_GAMMA_RATIO
- = log (gamma (Y0 + Y0_EPS) / gamma (Y + Y_EPS)). XDIFF
- accurately approximates the difference Y0 + Y0_EPS - Y -
- Y_EPS. Use Stirling's approximation. */
- float log_gamma_high
- = (xdiff * __log1pf ((y0 - e_hi - e_lo + y0_eps) / e_hi)
- + (y - 0.5f + y_eps) * __log1pf (xdiff / y));
- /* Compute the sum of (B_2k / 2k(2k-1))(Y0^-(2k-1) - Y^-(2k-1)). */
- float y0r = 1 / y0, yr = 1 / y;
- float y0r2 = y0r * y0r, yr2 = yr * yr;
- float rdiff = -xdiff / (y * y0);
- float bterm[NCOEFF];
- float dlast = rdiff, elast = rdiff * yr * (yr + y0r);
- bterm[0] = dlast * lgamma_coeff[0];
- for (size_t j = 1; j < NCOEFF; j++)
- {
- float dnext = dlast * y0r2 + elast;
- float enext = elast * yr2;
- bterm[j] = dnext * lgamma_coeff[j];
- dlast = dnext;
- elast = enext;
- }
- float log_gamma_low = 0;
- for (size_t j = 0; j < NCOEFF; j++)
- log_gamma_low += bterm[NCOEFF - 1 - j];
- log_gamma_ratio = log_gamma_high + log_gamma_low;
-
- return log_sinpi_ratio + log_gamma_ratio;
-}
+/* Not needed. */
diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps
index 759050a3c3..fbb590f98a 100644
--- a/sysdeps/loongarch/lp64/libm-test-ulps
+++ b/sysdeps/loongarch/lp64/libm-test-ulps
@@ -1139,22 +1139,18 @@ ldouble: 7
Function: "lgamma":
double: 4
-float: 7
ldouble: 5
Function: "lgamma_downward":
double: 5
-float: 7
ldouble: 8
Function: "lgamma_towardzero":
double: 5
-float: 6
ldouble: 5
Function: "lgamma_upward":
double: 5
-float: 6
ldouble: 8
Function: "log":
diff --git a/sysdeps/m68k/coldfire/fpu/libm-test-ulps b/sysdeps/m68k/coldfire/fpu/libm-test-ulps
index 8130d491e8..7e49468421 100644
--- a/sysdeps/m68k/coldfire/fpu/libm-test-ulps
+++ b/sysdeps/m68k/coldfire/fpu/libm-test-ulps
@@ -125,7 +125,6 @@ float: 4
Function: "lgamma":
double: 1
-float: 2
Function: "log10":
double: 1
diff --git a/sysdeps/m68k/m680x0/fpu/libm-test-ulps b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
index 08fbad9c4a..50080f46b3 100644
--- a/sysdeps/m68k/m680x0/fpu/libm-test-ulps
+++ b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
@@ -1017,22 +1017,18 @@ ldouble: 5
Function: "lgamma":
double: 3
-float: 7
ldouble: 2
Function: "lgamma_downward":
double: 3
-float: 7
ldouble: 3
Function: "lgamma_towardzero":
double: 4
-float: 6
ldouble: 3
Function: "lgamma_upward":
double: 4
-float: 6
ldouble: 2
Function: "log10_downward":
diff --git a/sysdeps/microblaze/libm-test-ulps b/sysdeps/microblaze/libm-test-ulps
index 5382a18115..e7dda11ac3 100644
--- a/sysdeps/microblaze/libm-test-ulps
+++ b/sysdeps/microblaze/libm-test-ulps
@@ -210,7 +210,6 @@ float: 4
Function: "lgamma":
double: 4
-float: 4
Function: "log":
float: 1
diff --git a/sysdeps/mips/mips32/libm-test-ulps b/sysdeps/mips/mips32/libm-test-ulps
index 0fe27ef417..8a9140e6f9 100644
--- a/sysdeps/mips/mips32/libm-test-ulps
+++ b/sysdeps/mips/mips32/libm-test-ulps
@@ -908,19 +908,15 @@ float: 5
Function: "lgamma":
double: 4
-float: 7
Function: "lgamma_downward":
double: 5
-float: 7
Function: "lgamma_towardzero":
double: 5
-float: 6
Function: "lgamma_upward":
double: 5
-float: 6
Function: "log":
float: 1
diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
index ce7dde2e65..6e60768b5f 100644
--- a/sysdeps/mips/mips64/libm-test-ulps
+++ b/sysdeps/mips/mips64/libm-test-ulps
@@ -1143,22 +1143,18 @@ ldouble: 7
Function: "lgamma":
double: 4
-float: 7
ldouble: 5
Function: "lgamma_downward":
double: 5
-float: 7
ldouble: 8
Function: "lgamma_towardzero":
double: 5
-float: 6
ldouble: 5
Function: "lgamma_upward":
double: 5
-float: 6
ldouble: 8
Function: "log":
diff --git a/sysdeps/nios2/libm-test-ulps b/sysdeps/nios2/libm-test-ulps
index cc63f8fe9f..f9f5edbe63 100644
--- a/sysdeps/nios2/libm-test-ulps
+++ b/sysdeps/nios2/libm-test-ulps
@@ -216,7 +216,6 @@ float: 4
Function: "lgamma":
double: 4
-float: 7
Function: "log":
float: 1
diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps
index 5677a353ed..46605505f1 100644
--- a/sysdeps/or1k/fpu/libm-test-ulps
+++ b/sysdeps/or1k/fpu/libm-test-ulps
@@ -881,19 +881,15 @@ float: 9
Function: "lgamma":
double: 4
-float: 7
Function: "lgamma_downward":
double: 7
-float: 7
Function: "lgamma_towardzero":
double: 7
-float: 7
Function: "lgamma_upward":
double: 5
-float: 6
Function: "log10":
double: 2
diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps
index c7ba12fe19..b00a55a2a3 100644
--- a/sysdeps/or1k/nofpu/libm-test-ulps
+++ b/sysdeps/or1k/nofpu/libm-test-ulps
@@ -879,19 +879,15 @@ float: 9
Function: "lgamma":
double: 4
-float: 7
Function: "lgamma_downward":
double: 7
-float: 7
Function: "lgamma_towardzero":
double: 7
-float: 7
Function: "lgamma_upward":
double: 5
-float: 6
Function: "log10":
double: 2
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index 4e448a263b..56ca580497 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -1431,25 +1431,21 @@ ldouble: 5
Function: "lgamma":
double: 3
-float: 4
float128: 5
ldouble: 3
Function: "lgamma_downward":
double: 4
-float: 4
float128: 8
ldouble: 15
Function: "lgamma_towardzero":
double: 4
-float: 3
float128: 5
ldouble: 16
Function: "lgamma_upward":
double: 4
-float: 5
float128: 8
ldouble: 11
diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
index d9555e7706..752d1937c6 100644
--- a/sysdeps/powerpc/nofpu/libm-test-ulps
+++ b/sysdeps/powerpc/nofpu/libm-test-ulps
@@ -1201,22 +1201,18 @@ ldouble: 1
Function: "lgamma":
double: 4
-float: 7
ldouble: 3
Function: "lgamma_downward":
double: 5
-float: 7
ldouble: 15
Function: "lgamma_towardzero":
double: 5
-float: 6
ldouble: 16
Function: "lgamma_upward":
double: 5
-float: 6
ldouble: 11
Function: "log":
diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps
index 23228a80a9..acb3db4045 100644
--- a/sysdeps/riscv/nofpu/libm-test-ulps
+++ b/sysdeps/riscv/nofpu/libm-test-ulps
@@ -1112,22 +1112,18 @@ ldouble: 7
Function: "lgamma":
double: 4
-float: 7
ldouble: 5
Function: "lgamma_downward":
double: 4
-float: 4
ldouble: 8
Function: "lgamma_towardzero":
double: 4
-float: 3
ldouble: 5
Function: "lgamma_upward":
double: 4
-float: 5
ldouble: 8
Function: "log":
diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps
index 74bde1024a..3f7673ccc5 100644
--- a/sysdeps/riscv/rvd/libm-test-ulps
+++ b/sysdeps/riscv/rvd/libm-test-ulps
@@ -1139,22 +1139,18 @@ ldouble: 7
Function: "lgamma":
double: 3
-float: 3
ldouble: 5
Function: "lgamma_downward":
double: 4
-float: 4
ldouble: 8
Function: "lgamma_towardzero":
double: 4
-float: 3
ldouble: 5
Function: "lgamma_upward":
double: 4
-float: 5
ldouble: 8
Function: "log":
diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
index 6747fd4f7b..3a1ad5c4e9 100644
--- a/sysdeps/s390/fpu/libm-test-ulps
+++ b/sysdeps/s390/fpu/libm-test-ulps
@@ -1141,22 +1141,18 @@ ldouble: 7
Function: "lgamma":
double: 3
-float: 3
ldouble: 5
Function: "lgamma_downward":
double: 4
-float: 4
ldouble: 8
Function: "lgamma_towardzero":
double: 4
-float: 3
ldouble: 5
Function: "lgamma_upward":
double: 4
-float: 5
ldouble: 8
Function: "log":
diff --git a/sysdeps/sh/libm-test-ulps b/sysdeps/sh/libm-test-ulps
index 69fe20bc0a..810a73648c 100644
--- a/sysdeps/sh/libm-test-ulps
+++ b/sysdeps/sh/libm-test-ulps
@@ -435,11 +435,9 @@ float: 5
Function: "lgamma":
double: 4
-float: 3
Function: "lgamma_towardzero":
double: 5
-float: 3
Function: "log":
float: 1
diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
index 98f7a07190..9c6ddd10c1 100644
--- a/sysdeps/sparc/fpu/libm-test-ulps
+++ b/sysdeps/sparc/fpu/libm-test-ulps
@@ -1143,22 +1143,18 @@ ldouble: 7
Function: "lgamma":
double: 4
-float: 7
ldouble: 5
Function: "lgamma_downward":
double: 5
-float: 7
ldouble: 8
Function: "lgamma_towardzero":
double: 5
-float: 6
ldouble: 5
Function: "lgamma_upward":
double: 5
-float: 6
ldouble: 8
Function: "log":
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index b7400e9969..8f531e2992 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -1712,25 +1712,21 @@ ldouble: 5
Function: "lgamma":
double: 4
-float: 7
float128: 5
ldouble: 4
Function: "lgamma_downward":
double: 5
-float: 7
float128: 8
ldouble: 7
Function: "lgamma_towardzero":
double: 5
-float: 6
float128: 5
ldouble: 7
Function: "lgamma_upward":
double: 5
-float: 6
float128: 8
ldouble: 6
--
2.43.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 11/11] math: Use tanf from CORE-MATH
2024-11-11 13:45 [PATCH 00/11] Add more CORE-math implementations to libm Adhemerval Zanella
` (9 preceding siblings ...)
2024-11-11 13:45 ` [PATCH 10/11] math: Use lgammaf " Adhemerval Zanella
@ 2024-11-11 13:45 ` Adhemerval Zanella
2024-11-12 0:23 ` Joseph Myers
` (2 more replies)
10 siblings, 3 replies; 34+ messages in thread
From: Adhemerval Zanella @ 2024-11-11 13:45 UTC (permalink / raw)
To: libc-alpha; +Cc: Alexei Sibidanov, Paul Zimmermann
The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance to the generic tanf.
The code was adapted to glibc style, to use the definition of
math_config.h, to remove errno handling, and to use a generic
128 bit routine for ABIs that do not support it natively.
Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (neoverse1,
gcc 13.2.1), and powerpc (POWER10, gcc 13.2.1):
latency master patched improvement
x86_64 82.3961 54.8052 33.49%
x86_64v2 82.3415 54.8052 33.44%
x86_64v3 69.3661 50.4864 27.22%
i686 219.271 45.5396 79.23%
aarch64 29.2127 19.1951 34.29%
power10 19.5060 16.2760 16.56%
reciprocal-throughput master patched improvement
x86_64 28.3976 19.7334 30.51%
x86_64v2 28.4568 19.7334 30.65%
x86_64v3 21.1815 16.1811 23.61%
i686 105.016 15.1426 85.58%
aarch64 18.1573 10.7681 40.70%
power10 8.7207 8.7097 0.13%
Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
---
SHARED-FILES | 6 +
sysdeps/aarch64/libm-test-ulps | 4 -
sysdeps/alpha/fpu/libm-test-ulps | 4 -
sysdeps/arc/fpu/libm-test-ulps | 4 -
sysdeps/arc/nofpu/libm-test-ulps | 3 -
sysdeps/arm/libm-test-ulps | 6 -
sysdeps/csky/fpu/libm-test-ulps | 6 -
sysdeps/csky/nofpu/libm-test-ulps | 6 -
sysdeps/generic/math_int128.h | 144 ++++++++++++
sysdeps/hppa/fpu/libm-test-ulps | 4 -
sysdeps/i386/fpu/libm-test-ulps | 4 -
.../i386/i686/fpu/multiarch/libm-test-ulps | 4 -
sysdeps/ieee754/flt-32/k_tanf.c | 102 +-------
sysdeps/ieee754/flt-32/s_tanf.c | 220 +++++++++++++-----
sysdeps/loongarch/lp64/libm-test-ulps | 4 -
sysdeps/microblaze/libm-test-ulps | 3 -
sysdeps/mips/mips32/libm-test-ulps | 6 -
sysdeps/mips/mips64/libm-test-ulps | 4 -
sysdeps/nios2/libm-test-ulps | 3 -
sysdeps/or1k/fpu/libm-test-ulps | 6 -
sysdeps/or1k/nofpu/libm-test-ulps | 6 -
sysdeps/powerpc/fpu/libm-test-ulps | 4 -
sysdeps/powerpc/nofpu/libm-test-ulps | 4 -
sysdeps/riscv/nofpu/libm-test-ulps | 4 -
sysdeps/riscv/rvd/libm-test-ulps | 4 -
sysdeps/s390/fpu/libm-test-ulps | 4 -
sysdeps/sh/libm-test-ulps | 4 -
sysdeps/sparc/fpu/libm-test-ulps | 4 -
sysdeps/x86_64/fpu/libm-test-ulps | 4 -
29 files changed, 311 insertions(+), 270 deletions(-)
create mode 100644 sysdeps/generic/math_int128.h
diff --git a/SHARED-FILES b/SHARED-FILES
index 033ce7f092..580e6b231a 100644
--- a/SHARED-FILES
+++ b/SHARED-FILES
@@ -288,3 +288,9 @@ sysdeps/ieee754/flt-32/e_lgammaf_r.c:
- remove the errno stuff (this is done by the wrapper)
- replace 0x1p127f * 0x1p127f by math_narrow_eval (x * 0x1p127f)
- add libm_alias_finite (__ieee754_lgammaf_r, __lgammaf_r) at the end
+sysdeps/ieee754/flt-32/s_tanf.c:
+ (src/binary32/tan/tanf.cc in CORE-MATH)
+ - The code was adapted to use glibc code style and internal
+ functions to handle errno, overflow, and underflow. It was changed
+ to use an internal wrapper for 128 bit unsigned integer operation
+ for ABIs that do not support the type natively.
diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulps
index 1d3d1f9b6a..89b166b71b 100644
--- a/sysdeps/aarch64/libm-test-ulps
+++ b/sysdeps/aarch64/libm-test-ulps
@@ -1561,7 +1561,6 @@ float: 3
ldouble: 4
Function: "tan":
-float: 1
ldouble: 1
Function: "tan_advsimd":
@@ -1570,7 +1569,6 @@ float: 2
Function: "tan_downward":
double: 1
-float: 2
ldouble: 1
Function: "tan_sve":
@@ -1579,12 +1577,10 @@ float: 2
Function: "tan_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "tan_upward":
double: 1
-float: 1
ldouble: 1
Function: "tanh":
diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
index 7256e674bb..0f7628b75b 100644
--- a/sysdeps/alpha/fpu/libm-test-ulps
+++ b/sysdeps/alpha/fpu/libm-test-ulps
@@ -1342,22 +1342,18 @@ float: 3
ldouble: 4
Function: "tan":
-float: 1
ldouble: 1
Function: "tan_downward":
double: 1
-float: 2
ldouble: 1
Function: "tan_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "tan_upward":
double: 1
-float: 1
ldouble: 1
Function: "tanh":
diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
index 66a2b541c6..4d4b22db47 100644
--- a/sysdeps/arc/fpu/libm-test-ulps
+++ b/sysdeps/arc/fpu/libm-test-ulps
@@ -1081,19 +1081,15 @@ float: 3
Function: "tan":
double: 1
-float: 1
Function: "tan_downward":
double: 1
-float: 2
Function: "tan_towardzero":
double: 1
-float: 2
Function: "tan_upward":
double: 1
-float: 2
Function: "tanh":
double: 3
diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps
index 38836ddc38..4faf784aad 100644
--- a/sysdeps/arc/nofpu/libm-test-ulps
+++ b/sysdeps/arc/nofpu/libm-test-ulps
@@ -259,9 +259,6 @@ Function: "sinh":
double: 2
float: 2
-Function: "tan":
-float: 1
-
Function: "tanh":
double: 2
float: 2
diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
index 2651046cfa..c80122de79 100644
--- a/sysdeps/arm/libm-test-ulps
+++ b/sysdeps/arm/libm-test-ulps
@@ -1078,20 +1078,14 @@ Function: "sinh_upward":
double: 3
float: 3
-Function: "tan":
-float: 1
-
Function: "tan_downward":
double: 1
-float: 2
Function: "tan_towardzero":
double: 1
-float: 1
Function: "tan_upward":
double: 1
-float: 1
Function: "tanh":
double: 2
diff --git a/sysdeps/csky/fpu/libm-test-ulps b/sysdeps/csky/fpu/libm-test-ulps
index 02b4cb4934..d67cfe1785 100644
--- a/sysdeps/csky/fpu/libm-test-ulps
+++ b/sysdeps/csky/fpu/libm-test-ulps
@@ -1000,20 +1000,14 @@ Function: "sinh_upward":
double: 3
float: 3
-Function: "tan":
-float: 1
-
Function: "tan_downward":
double: 1
-float: 2
Function: "tan_towardzero":
double: 1
-float: 1
Function: "tan_upward":
double: 1
-float: 1
Function: "tanh":
double: 2
diff --git a/sysdeps/csky/nofpu/libm-test-ulps b/sysdeps/csky/nofpu/libm-test-ulps
index 34312f5a06..6cdf9fd034 100644
--- a/sysdeps/csky/nofpu/libm-test-ulps
+++ b/sysdeps/csky/nofpu/libm-test-ulps
@@ -1031,20 +1031,14 @@ Function: "sinh_upward":
double: 3
float: 3
-Function: "tan":
-float: 1
-
Function: "tan_downward":
double: 1
-float: 2
Function: "tan_towardzero":
double: 1
-float: 1
Function: "tan_upward":
double: 1
-float: 1
Function: "tanh":
double: 2
diff --git a/sysdeps/generic/math_int128.h b/sysdeps/generic/math_int128.h
new file mode 100644
index 0000000000..16bd34dd60
--- /dev/null
+++ b/sysdeps/generic/math_int128.h
@@ -0,0 +1,144 @@
+/* Internal 128 bit int support.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _MATH_INT128_H
+#define _MATH_INT128_H
+
+/* Limited support for internal 128 bit integer, used on some math
+ implementations. It uses compiler builtin type if supported, otherwise
+ it is emulate. Only unsigned and some operations are currently supported:
+
+ - u128_t: the 128 bit unsigned type.
+ - u128_high: return the high part of the number.
+ - u128_low: return the low part of the number.
+ - u128_from_u64: createa 128 bit number from a 64 bit one.
+ - u128_mul: multiple two 128 bit numbers.
+ - u128_add: add two 128 bit numbers.
+ - u128_lshift: left shift a number.
+ - u128_rshift: right shift a number.
+ */
+
+#ifdef __SIZEOF_INT128__
+typedef unsigned __int128 u128;
+# define u128_high(__x) (uint64_t)((__x) >> 64)
+# define u128_low(__x) (uint64_t)(__x)
+# define u128_from_u64(__x) (u128)(__x)
+# define u128_mul(__x, __y) (__x) * (__y)
+# define u128_add(__x, __y) (__x) + (__y)
+# define u128_lshift(__x, __y) (__x) << (__y)
+# define u128_rshift(__x, __y) (__x) >> (__y)
+#else
+typedef struct
+{
+ uint64_t low;
+ uint64_t high;
+} u128;
+
+# define u128_high(__x) (__x).high
+# define u128_low(__x) (__x).low
+
+# define u128_from_u64(__x) (u128){.low = (__x), .high = 0}
+
+# define TOPBIT (UINT64_C(1) << 63)
+# define MASK32 (UINT64_C(0xffffffff))
+
+static u128 u128_add (u128 x, u128 y)
+{
+ uint64_t lower = (x.low & ~TOPBIT) + (y.low & ~TOPBIT);
+ bool carry = (lower >> 63) + (x.low >> 63) + (y.low >> 63) > 1;
+ return (u128) { .high = x.high + y.high + carry, .low = x.low + y.low };
+}
+
+static u128 u128_lshift (u128 x, unsigned int n)
+{
+ switch (n)
+ {
+ case 0: return x;
+ case 1 ... 63: return (u128) { .high = (x.high << n) | (x.low >> (64 - n)),
+ .low = x.low << n };
+ case 64 ...127: return (u128) { .high = x.low << (n - 64), .low = 0};
+ default: return (u128) { .high = 0, .low = 0 };
+ }
+}
+
+static u128 u128_rshift (u128 x, unsigned int n)
+{
+ switch (n)
+ {
+ case 0: return x;
+ case 1 ... 63: return (u128) { .high = x.high >> n,
+ .low = (x.high << (64 - n)) | (x.low >> n) };
+ case 64 ...127: return (u128) { .high = 0, .low = x.high >> (n - 64) };
+ default: return (u128) { .high = 0, .low = 0 };
+ }
+}
+
+static u128 u128_mul (u128 x, u128 y)
+{
+ if (x.high == 0 && y.high == 0)
+ {
+ uint64_t x0 = x.low & MASK32;
+ uint64_t x1 = x.low >> 32;
+ uint64_t y0 = y.low & MASK32;
+ uint64_t y1 = y.low >> 32;
+ u128 x0y0 = { .high = 0, .low = x0 * y0 };
+ u128 x0y1 = { .high = 0, .low = x0 * y1 };
+ u128 x1y0 = { .high = 0, .low = x1 * y0 };
+ u128 x1y1 = { .high = 0, .low = x1 * y1 };
+ /* x0y0 + ((x0y1 + x1y0) << 32) + (x1y1 << 64) */
+ return u128_add (u128_add (x0y0, u128_lshift (u128_add (x0y1,
+ x1y0),
+ 32)),
+ u128_lshift (x1y1, 64));
+ }
+ else
+ {
+ uint64_t x0 = x.low & MASK32;
+ uint64_t x1 = x.low >> 32;
+ uint64_t x2 = x.high & MASK32;
+ uint64_t x3 = x.high >> 32;
+ uint64_t y0 = y.low & MASK32;
+ uint64_t y1 = y.low >> 32;
+ uint64_t y2 = y.high & MASK32;
+ uint64_t y3 = y.high >> 32;
+ u128 x0y0 = { .high = 0, .low = x0 * y0 };
+ u128 x0y1 = { .high = 0, .low = x0 * y1 };
+ u128 x0y2 = { .high = 0, .low = x0 * y2 };
+ u128 x0y3 = { .high = 0, .low = x0 * y3 };
+ u128 x1y0 = { .high = 0, .low = x1 * y0 };
+ u128 x1y1 = { .high = 0, .low = x1 * y1 };
+ u128 x1y2 = { .high = 0, .low = x1 * y2 };
+ u128 x2y0 = { .high = 0, .low = x2 * y0 };
+ u128 x2y1 = { .high = 0, .low = x2 * y1 };
+ u128 x3y0 = { .high = 0, .low = x3 * y0 };
+ /* x0y0 + ((x0y1 + x1y0) << 32) + ((x0y2 + x1y1 + x2y0) << 64) +
+ ((x0y3 + x1y2 + x2y1 + x3y0) << 96) */
+ u128 r0 = u128_add (x0y0,
+ u128_lshift (u128_add (x0y1, x1y0),
+ 32));
+ u128 r1 = u128_add (u128_lshift (u128_add (u128_add (x0y2, x1y1), x2y0),
+ 64),
+ u128_lshift (u128_add (u128_add (x0y3, x1y2),
+ u128_add (x2y1, x3y0)),
+ 96));
+ return u128_add (r0, r1);
+ }
+}
+#endif /* __SIZEOF_INT128__ */
+
+#endif
diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
index 47bdd48e7f..d40d7e8d82 100644
--- a/sysdeps/hppa/fpu/libm-test-ulps
+++ b/sysdeps/hppa/fpu/libm-test-ulps
@@ -1104,20 +1104,16 @@ float: 3
Function: "tan":
double: 1
-float: 1
ldouble: 1
Function: "tan_downward":
double: 1
-float: 2
Function: "tan_towardzero":
double: 1
-float: 1
Function: "tan_upward":
double: 1
-float: 1
Function: "tanh":
double: 2
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 170e7cfc65..c06da68b45 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -1614,25 +1614,21 @@ float128: 4
ldouble: 5
Function: "tan":
-float: 1
float128: 1
ldouble: 2
Function: "tan_downward":
double: 1
-float: 2
float128: 1
ldouble: 3
Function: "tan_towardzero":
double: 1
-float: 2
float128: 1
ldouble: 3
Function: "tan_upward":
double: 1
-float: 2
float128: 1
ldouble: 2
diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
index a9ce632e6a..43ffbd7978 100644
--- a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
+++ b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
@@ -1619,25 +1619,21 @@ float128: 4
ldouble: 5
Function: "tan":
-float: 1
float128: 1
ldouble: 2
Function: "tan_downward":
double: 1
-float: 2
float128: 1
ldouble: 3
Function: "tan_towardzero":
double: 1
-float: 2
float128: 1
ldouble: 3
Function: "tan_upward":
double: 1
-float: 2
float128: 1
ldouble: 2
diff --git a/sysdeps/ieee754/flt-32/k_tanf.c b/sysdeps/ieee754/flt-32/k_tanf.c
index e1c9d14104..1cc8931700 100644
--- a/sysdeps/ieee754/flt-32/k_tanf.c
+++ b/sysdeps/ieee754/flt-32/k_tanf.c
@@ -1,101 +1 @@
-/* k_tanf.c -- float version of k_tan.c
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: k_tanf.c,v 1.4 1995/05/10 20:46:39 jtc Exp $";
-#endif
-
-#include <float.h>
-#include <math.h>
-#include <math_private.h>
-#include <math-underflow.h>
-static const float
-one = 1.0000000000e+00, /* 0x3f800000 */
-pio4 = 7.8539812565e-01, /* 0x3f490fda */
-pio4lo= 3.7748947079e-08, /* 0x33222168 */
-T[] = {
- 3.3333334327e-01, /* 0x3eaaaaab */
- 1.3333334029e-01, /* 0x3e088889 */
- 5.3968254477e-02, /* 0x3d5d0dd1 */
- 2.1869488060e-02, /* 0x3cb327a4 */
- 8.8632395491e-03, /* 0x3c11371f */
- 3.5920790397e-03, /* 0x3b6b6916 */
- 1.4562094584e-03, /* 0x3abede48 */
- 5.8804126456e-04, /* 0x3a1a26c8 */
- 2.4646313977e-04, /* 0x398137b9 */
- 7.8179444245e-05, /* 0x38a3f445 */
- 7.1407252108e-05, /* 0x3895c07a */
- -1.8558637748e-05, /* 0xb79bae5f */
- 2.5907305826e-05, /* 0x37d95384 */
-};
-
-float __kernel_tanf(float x, float y, int iy)
-{
- float z,r,v,w,s;
- int32_t ix,hx;
- GET_FLOAT_WORD(hx,x);
- ix = hx&0x7fffffff; /* high word of |x| */
- if(ix<0x39000000) /* x < 2**-13 */
- {if((int)x==0) { /* generate inexact */
- if((ix|(iy+1))==0) return one/fabsf(x);
- else if (iy == 1)
- {
- math_check_force_underflow (x);
- return x;
- }
- else
- return -one / x;
- }
- }
- if(ix>=0x3f2ca140) { /* |x|>=0.6744 */
- if(hx<0) {x = -x; y = -y;}
- z = pio4-x;
- w = pio4lo-y;
- x = z+w; y = 0.0;
- if (fabsf (x) < 0x1p-13f)
- return (1 - ((hx >> 30) & 2)) * iy * (1.0f - 2 * iy * x);
- }
- z = x*x;
- w = z*z;
- /* Break x^5*(T[1]+x^2*T[2]+...) into
- * x^5(T[1]+x^4*T[3]+...+x^20*T[11]) +
- * x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12]))
- */
- r = T[1]+w*(T[3]+w*(T[5]+w*(T[7]+w*(T[9]+w*T[11]))));
- v = z*(T[2]+w*(T[4]+w*(T[6]+w*(T[8]+w*(T[10]+w*T[12])))));
- s = z*x;
- r = y + z*(s*(r+v)+y);
- r += T[0]*s;
- w = x+r;
- if(ix>=0x3f2ca140) {
- v = (float)iy;
- return (float)(1-((hx>>30)&2))*(v-(float)2.0*(x-(w*w/(w+v)-r)));
- }
- if(iy==1) return w;
- else { /* if allow error up to 2 ulp,
- simply return -1.0/(x+r) here */
- /* compute -1.0/(x+r) accurately */
- float a,t;
- int32_t i;
- z = w;
- GET_FLOAT_WORD(i,z);
- SET_FLOAT_WORD(z,i&0xfffff000);
- v = r-(z - x); /* z+v = r+x */
- t = a = -(float)1.0/w; /* a = -1.0/w */
- GET_FLOAT_WORD(i,t);
- SET_FLOAT_WORD(t,i&0xfffff000);
- s = (float)1.0+t*z;
- return t+a*(s+t*v);
- }
-}
+/* Not needed. */
diff --git a/sysdeps/ieee754/flt-32/s_tanf.c b/sysdeps/ieee754/flt-32/s_tanf.c
index ae6600bd57..41fd8fe496 100644
--- a/sysdeps/ieee754/flt-32/s_tanf.c
+++ b/sysdeps/ieee754/flt-32/s_tanf.c
@@ -1,76 +1,176 @@
-/* s_tanf.c -- float version of s_tan.c.
- */
+/* Correctly-rounded tangent of binary32 value.
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
+Copyright (c) 2022-2024 Alexei Sibidanov.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_tanf.c,v 1.4 1995/05/10 20:48:20 jtc Exp $";
-#endif
+The original version of this file was copied from the CORE-MATH
+project (file src/binary32/tan/tanf.c, revision 59d21d7).
-#include <errno.h>
-#include <math.h>
-#include <math_private.h>
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#include <array_length.h>
+#include <stdint.h>
#include <libm-alias-float.h>
-#include "s_sincosf.h"
+#include "math_config.h"
+#include <math_int128.h>
-/* Reduce range of X to a multiple of PI/2. The modulo result is between
- -PI/4 and PI/4 and returned as a high part y[0] and a low part y[1].
- The low bit in the return value indicates the first or 2nd half of tanf. */
-static inline int32_t
-rem_pio2f (float x, float *y)
+static inline double
+rltl (float z, int *q)
{
- double dx = x;
- int n;
- const sincos_t *p = &__sincosf_table[0];
+ double x = z;
+ double idl = -0x1.b1bbead603d8bp-32 * x;
+ double idh = 0x1.45f306ep-1 * x;
+ double id = roundeven (idh);
+ *q = (int64_t) id;
+ return (idh - id) + idl;
+}
- if (__glibc_likely (abstop12 (x) < abstop12 (120.0f)))
- dx = reduce_fast (dx, p, &n);
- else
+static double __attribute__ ((noinline))
+rbig (uint32_t u, int *q)
+{
+ static const uint64_t ipi[] =
{
- uint32_t xi = asuint (x);
- int sign = xi >> 31;
-
- dx = reduce_large (xi, &n);
- dx = sign ? -dx : dx;
+ 0xfe5163abdebbc562, 0xdb6295993c439041,
+ 0xfc2757d1f534ddc0, 0xa2f9836e4e441529
+ };
+ int e = (u >> 23) & 0xff, i;
+ uint64_t m = (u & (~0u >> 9)) | 1 << 23;
+ u128 p0 = u128_mul (u128_from_u64 (m), u128_from_u64 (ipi[0]));
+ u128 p1 = u128_mul (u128_from_u64 (m), u128_from_u64 (ipi[1]));
+ p1 = u128_add (p1, u128_rshift (p0, 64));
+ u128 p2 = u128_mul (u128_from_u64 (m), u128_from_u64 (ipi[2]));
+ p2 = u128_add (p2, u128_rshift (p1, 64));
+ u128 p3 = u128_mul (u128_from_u64 (m), u128_from_u64 (ipi[3]));
+ p3 = u128_add (p3, u128_rshift (p2, 64));
+ uint64_t p3h = u128_high (p3);
+ uint64_t p3l = u128_low (p3);
+ uint64_t p2l = u128_low (p2);
+ uint64_t p1l = u128_low (p1);
+ int64_t a;
+ int k = e - 127, s = k - 23;
+ /* in ctanf(), rbig() is called in the case 127+28 <= e < 0xff
+ thus 155 <= e <= 254, which yields 28 <= k <= 127 and 5 <= s <= 104 */
+ if (s < 64)
+ {
+ i = p3h << s | p3l >> (64 - s);
+ a = p3l << s | p2l >> (64 - s);
}
-
- y[0] = dx;
- y[1] = dx - y[0];
- return n;
+ else if (s == 64)
+ {
+ i = p3l;
+ a = p2l;
+ }
+ else
+ { /* s > 64 */
+ i = p3l << (s - 64) | p2l >> (128 - s);
+ a = p2l << (s - 64) | p1l >> (128 - s);
+ }
+ int sgn = u;
+ sgn >>= 31;
+ int64_t sm = a >> 63;
+ i -= sm;
+ double z = (a ^ sgn) * 0x1p-64;
+ i = (i ^ sgn) - sgn;
+ *q = i;
+ return z;
}
-float __tanf(float x)
+float
+__tanf (float x)
{
- float y[2],z=0.0;
- int32_t n, ix;
-
- GET_FLOAT_WORD(ix,x);
-
- /* |x| ~< pi/4 */
- ix &= 0x7fffffff;
- if(ix <= 0x3f490fda) return __kernel_tanf(x,z,1);
-
- /* tan(Inf or NaN) is NaN */
- else if (ix>=0x7f800000) {
- if (ix==0x7f800000)
- __set_errno (EDOM);
- return x-x; /* NaN */
+ uint32_t t = asuint (x);
+ int e = (t >> 23) & 0xff;
+ int i;
+ double z;
+ if (__glibc_likely (e < 127 + 28))
+ {
+ if (__glibc_unlikely (e < 115))
+ {
+ if (__glibc_unlikely (e < 102))
+ return fmaf (x, fabsf (x), x);
+ float x2 = x * x;
+ return fmaf (x, 0x1.555556p-2f * x2, x);
}
-
- /* argument reduction needed */
- else {
- n = rem_pio2f(x,y);
- return __kernel_tanf(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even
- -1 -- n odd */
+ z = rltl (x, &i);
+ }
+ else if (e < 0xff)
+ z = rbig (t, &i);
+ else
+ {
+ if (t << 9)
+ return x + x; /* nan */
+ return __math_invalidf (x);
+ }
+ double z2 = z * z;
+ double z4 = z2 * z2;
+ static const double cn[] =
+ {
+ 0x1.921fb54442d18p+0, -0x1.fd226e573289fp-2,
+ 0x1.b7a60c8dac9f6p-6, -0x1.725beb40f33e5p-13
+ };
+ static const double cd[] =
+ {
+ 0x1p+0, -0x1.2395347fb829dp+0,
+ 0x1.2313660f29c36p-3, -0x1.9a707ab98d1c1p-9
+ };
+ static const double s[] = { 0, 1 };
+ double n = cn[0] + z2 * cn[1];
+ double n2 = cn[2] + z2 * cn[3];
+ n += z4 * n2;
+ double d = cd[0] + z2 * cd[1];
+ double d2 = cd[2] + z2 * cd[3];
+ d += z4 * d2;
+ n *= z;
+ double s0 = s[i & 1];
+ double s1 = s[1 - (i & 1)];
+ double r1 = (n * s1 - d * s0) / (n * s0 + d * s1);
+ uint64_t tail = (asuint64 (r1) + 7) & (~UINT64_C(0) >> 35);
+ if (__glibc_unlikely (tail <= 14))
+ {
+ static const struct
+ {
+ float arg;
+ float rh;
+ float rl;
+ } st[] = {
+ { 0x1.143ec4p+0f, 0x1.ddf9f6p+0f, -0x1.891d24p-52f },
+ { 0x1.ada6aap+27f, 0x1.e80304p-3f, 0x1.419f46p-58f },
+ { 0x1.af61dap+48f, 0x1.60d1c8p-2f, -0x1.2d6c3ap-55f },
+ { 0x1.0088bcp+52f, 0x1.ca1edp+0f, 0x1.f6053p-53f },
+ { 0x1.f90dfcp+72f, 0x1.597f9cp-1f, 0x1.925978p-53f },
+ { 0x1.cc4e22p+85f, -0x1.f33584p+1f, 0x1.d7254ap-51f },
+ { 0x1.a6ce12p+86f, -0x1.c5612ep-1f, -0x1.26c33ep-53f },
+ { 0x1.6a0b76p+102f, -0x1.e42a1ep+0f, -0x1.1dc906p-52f },
+ };
+ uint32_t ax = t & (~0u >> 1);
+ uint32_t sgn = t >> 31;
+ for (int j = 0; j < array_length (st); j++)
+ {
+ if (__glibc_unlikely (asfloat (st[j].arg) == ax))
+ {
+ if (sgn)
+ return -st[j].rh - st[j].rl;
+ else
+ return st[j].rh + st[j].rl;
+ }
}
+ }
+ return r1;
}
libm_alias_float (__tan, tan)
diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps
index fbb590f98a..a626f32736 100644
--- a/sysdeps/loongarch/lp64/libm-test-ulps
+++ b/sysdeps/loongarch/lp64/libm-test-ulps
@@ -1348,22 +1348,18 @@ ldouble: 4
Function: "tan":
double: 1
-float: 1
ldouble: 1
Function: "tan_downward":
double: 1
-float: 2
ldouble: 1
Function: "tan_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "tan_upward":
double: 1
-float: 1
ldouble: 1
Function: "tanh":
diff --git a/sysdeps/microblaze/libm-test-ulps b/sysdeps/microblaze/libm-test-ulps
index e7dda11ac3..c96652a022 100644
--- a/sysdeps/microblaze/libm-test-ulps
+++ b/sysdeps/microblaze/libm-test-ulps
@@ -241,9 +241,6 @@ Function: "sinh":
double: 2
float: 2
-Function: "tan":
-float: 1
-
Function: "tanh":
double: 2
float: 2
diff --git a/sysdeps/mips/mips32/libm-test-ulps b/sysdeps/mips/mips32/libm-test-ulps
index 8a9140e6f9..17034d44ba 100644
--- a/sysdeps/mips/mips32/libm-test-ulps
+++ b/sysdeps/mips/mips32/libm-test-ulps
@@ -1079,20 +1079,14 @@ Function: "sinh_upward":
double: 3
float: 3
-Function: "tan":
-float: 1
-
Function: "tan_downward":
double: 1
-float: 2
Function: "tan_towardzero":
double: 1
-float: 1
Function: "tan_upward":
double: 1
-float: 1
Function: "tanh":
double: 2
diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
index 6e60768b5f..a757f69a9a 100644
--- a/sysdeps/mips/mips64/libm-test-ulps
+++ b/sysdeps/mips/mips64/libm-test-ulps
@@ -1360,22 +1360,18 @@ float: 3
ldouble: 4
Function: "tan":
-float: 1
ldouble: 1
Function: "tan_downward":
double: 1
-float: 2
ldouble: 1
Function: "tan_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "tan_upward":
double: 1
-float: 1
ldouble: 1
Function: "tanh":
diff --git a/sysdeps/nios2/libm-test-ulps b/sysdeps/nios2/libm-test-ulps
index f9f5edbe63..a0a2b6923f 100644
--- a/sysdeps/nios2/libm-test-ulps
+++ b/sysdeps/nios2/libm-test-ulps
@@ -250,9 +250,6 @@ Function: "sinh":
double: 2
float: 2
-Function: "tan":
-float: 1
-
Function: "tanh":
double: 2
float: 2
diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps
index 46605505f1..115a73ef26 100644
--- a/sysdeps/or1k/fpu/libm-test-ulps
+++ b/sysdeps/or1k/fpu/libm-test-ulps
@@ -1013,20 +1013,14 @@ Function: "sinh_upward":
double: 3
float: 3
-Function: "tan":
-float: 1
-
Function: "tan_downward":
double: 1
-float: 2
Function: "tan_towardzero":
double: 1
-float: 1
Function: "tan_upward":
double: 1
-float: 1
Function: "tanh":
double: 2
diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps
index b00a55a2a3..e130fd8a1d 100644
--- a/sysdeps/or1k/nofpu/libm-test-ulps
+++ b/sysdeps/or1k/nofpu/libm-test-ulps
@@ -1003,20 +1003,14 @@ Function: "sinh_upward":
double: 3
float: 3
-Function: "tan":
-float: 1
-
Function: "tan_downward":
double: 1
-float: 2
Function: "tan_towardzero":
double: 1
-float: 1
Function: "tan_upward":
double: 1
-float: 1
Function: "tanh":
double: 2
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index 56ca580497..adaa10fb56 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -1737,25 +1737,21 @@ double: 1
float: 1
Function: "tan":
-float: 3
float128: 1
ldouble: 2
Function: "tan_downward":
double: 1
-float: 3
float128: 1
ldouble: 3
Function: "tan_towardzero":
double: 1
-float: 3
float128: 1
ldouble: 2
Function: "tan_upward":
double: 1
-float: 3
float128: 1
ldouble: 3
diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
index 752d1937c6..2c44e39c2c 100644
--- a/sysdeps/powerpc/nofpu/libm-test-ulps
+++ b/sysdeps/powerpc/nofpu/libm-test-ulps
@@ -1476,22 +1476,18 @@ double: 1
float: 1
Function: "tan":
-float: 1
ldouble: 2
Function: "tan_downward":
double: 1
-float: 2
ldouble: 3
Function: "tan_towardzero":
double: 1
-float: 1
ldouble: 2
Function: "tan_upward":
double: 1
-float: 1
ldouble: 3
Function: "tanh":
diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps
index acb3db4045..84b9e15f43 100644
--- a/sysdeps/riscv/nofpu/libm-test-ulps
+++ b/sysdeps/riscv/nofpu/libm-test-ulps
@@ -1289,22 +1289,18 @@ float: 3
ldouble: 4
Function: "tan":
-float: 1
ldouble: 1
Function: "tan_downward":
double: 1
-float: 2
ldouble: 1
Function: "tan_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "tan_upward":
double: 1
-float: 1
ldouble: 1
Function: "tanh":
diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps
index 3f7673ccc5..b9446e5a7c 100644
--- a/sysdeps/riscv/rvd/libm-test-ulps
+++ b/sysdeps/riscv/rvd/libm-test-ulps
@@ -1347,22 +1347,18 @@ float: 3
ldouble: 4
Function: "tan":
-float: 1
ldouble: 1
Function: "tan_downward":
double: 1
-float: 2
ldouble: 1
Function: "tan_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "tan_upward":
double: 1
-float: 1
ldouble: 1
Function: "tanh":
diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
index 3a1ad5c4e9..62d3f145fc 100644
--- a/sysdeps/s390/fpu/libm-test-ulps
+++ b/sysdeps/s390/fpu/libm-test-ulps
@@ -1346,22 +1346,18 @@ float: 3
ldouble: 4
Function: "tan":
-float: 1
ldouble: 1
Function: "tan_downward":
double: 1
-float: 2
ldouble: 1
Function: "tan_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "tan_upward":
double: 1
-float: 1
ldouble: 1
Function: "tanh":
diff --git a/sysdeps/sh/libm-test-ulps b/sysdeps/sh/libm-test-ulps
index 810a73648c..a6d271eb3f 100644
--- a/sysdeps/sh/libm-test-ulps
+++ b/sysdeps/sh/libm-test-ulps
@@ -501,12 +501,8 @@ Function: "sinh_towardzero":
double: 3
float: 2
-Function: "tan":
-float: 1
-
Function: "tan_towardzero":
double: 1
-float: 1
Function: "tanh":
double: 2
diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
index 9c6ddd10c1..9276ff9726 100644
--- a/sysdeps/sparc/fpu/libm-test-ulps
+++ b/sysdeps/sparc/fpu/libm-test-ulps
@@ -1360,22 +1360,18 @@ float: 3
ldouble: 4
Function: "tan":
-float: 1
ldouble: 1
Function: "tan_downward":
double: 1
-float: 2
ldouble: 1
Function: "tan_towardzero":
double: 1
-float: 1
ldouble: 1
Function: "tan_upward":
double: 1
-float: 1
ldouble: 1
Function: "tanh":
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index 8f531e2992..f4360598a9 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -2136,25 +2136,21 @@ Function: "sinh_vlen8_avx2":
float: 1
Function: "tan":
-float: 1
float128: 1
ldouble: 2
Function: "tan_downward":
double: 1
-float: 2
float128: 1
ldouble: 3
Function: "tan_towardzero":
double: 1
-float: 1
float128: 1
ldouble: 3
Function: "tan_upward":
double: 1
-float: 1
float128: 1
ldouble: 2
--
2.43.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 11/11] math: Use tanf from CORE-MATH
2024-11-11 13:45 ` [PATCH 11/11] math: Use tanf " Adhemerval Zanella
@ 2024-11-12 0:23 ` Joseph Myers
2024-11-12 17:42 ` Adhemerval Zanella Netto
2024-11-12 13:17 ` Paul Zimmermann
2024-11-21 3:19 ` DJ Delorie
2 siblings, 1 reply; 34+ messages in thread
From: Joseph Myers @ 2024-11-12 0:23 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, Alexei Sibidanov, Paul Zimmermann
On Mon, 11 Nov 2024, Adhemerval Zanella wrote:
> +#ifdef __SIZEOF_INT128__
> +typedef unsigned __int128 u128;
> +# define u128_high(__x) (uint64_t)((__x) >> 64)
> +# define u128_low(__x) (uint64_t)(__x)
> +# define u128_from_u64(__x) (u128)(__x)
> +# define u128_mul(__x, __y) (__x) * (__y)
> +# define u128_add(__x, __y) (__x) + (__y)
> +# define u128_lshift(__x, __y) (__x) << (__y)
> +# define u128_rshift(__x, __y) (__x) >> (__y)
> +#else
> +typedef struct
I'd suggest also having an option for the case of defined
__BITINT_MAXWIDTH__ && __BITINT_MAXWIDTH__ >= 128, that uses unsigned
_BitInt (128) in that case (and would look essentially like the unsigned
__int128 case). (You can test that with GCC 14 or later on 32-bit x86.)
--
Joseph S. Myers
josmyers@redhat.com
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 11/11] math: Use tanf from CORE-MATH
2024-11-11 13:45 ` [PATCH 11/11] math: Use tanf " Adhemerval Zanella
2024-11-12 0:23 ` Joseph Myers
@ 2024-11-12 13:17 ` Paul Zimmermann
2024-11-12 18:41 ` Adhemerval Zanella Netto
2024-11-21 3:19 ` DJ Delorie
2 siblings, 1 reply; 34+ messages in thread
From: Paul Zimmermann @ 2024-11-12 13:17 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, sibid
Hi Adhemerval,
some typos and possible improvements (this is not a review since I am in
the "Signed-off-by" fields):
> + (src/binary32/tan/tanf.cc in CORE-MATH)
should be src/binary32/tan/tanf.c
> + - The code was adapted to use glibc code style and internal
> + functions to handle errno, overflow, and underflow. It was changed
> + to use an internal wrapper for 128 bit unsigned integer operation
maybe "operations"?
> +/* Limited support for internal 128 bit integer, used on some math
> + implementations. It uses compiler builtin type if supported, otherwise
> + it is emulate. Only unsigned and some operations are currently supported:
emulate -> emulated
> +
> + - u128_t: the 128 bit unsigned type.
> + - u128_high: return the high part of the number.
> + - u128_low: return the low part of the number.
> + - u128_from_u64: createa 128 bit number from a 64 bit one.
create a
> + - u128_mul: multiple two 128 bit numbers.
multiply
> + - u128_add: add two 128 bit numbers.
> + - u128_lshift: left shift a number.
> + - u128_rshift: right shift a number.
> + */
> +
> +#ifdef __SIZEOF_INT128__
> +typedef unsigned __int128 u128;
> +# define u128_high(__x) (uint64_t)((__x) >> 64)
> +# define u128_low(__x) (uint64_t)(__x)
> +# define u128_from_u64(__x) (u128)(__x)
> +# define u128_mul(__x, __y) (__x) * (__y)
> +# define u128_add(__x, __y) (__x) + (__y)
> +# define u128_lshift(__x, __y) (__x) << (__y)
> +# define u128_rshift(__x, __y) (__x) >> (__y)
> +#else
> +typedef struct
> +{
> + uint64_t low;
> + uint64_t high;
> +} u128;
> +
> +# define u128_high(__x) (__x).high
> +# define u128_low(__x) (__x).low
> +
> +# define u128_from_u64(__x) (u128){.low = (__x), .high = 0}
> +
> +# define TOPBIT (UINT64_C(1) << 63)
> +# define MASK32 (UINT64_C(0xffffffff))
> +
> +static u128 u128_add (u128 x, u128 y)
> +{
> + uint64_t lower = (x.low & ~TOPBIT) + (y.low & ~TOPBIT);
> + bool carry = (lower >> 63) + (x.low >> 63) + (y.low >> 63) > 1;
> + return (u128) { .high = x.high + y.high + carry, .low = x.low + y.low };
why not simply the following?
bool carry = x.low + y.low < x.low;
return (u128) { ... };
> +}
> +
> +static u128 u128_lshift (u128 x, unsigned int n)
> +{
> + switch (n)
> + {
> + case 0: return x;
> + case 1 ... 63: return (u128) { .high = (x.high << n) | (x.low >> (64 - n)),
> + .low = x.low << n };
> + case 64 ...127: return (u128) { .high = x.low << (n - 64), .low = 0};
> + default: return (u128) { .high = 0, .low = 0 };
> + }
> +}
> +
> +static u128 u128_rshift (u128 x, unsigned int n)
> +{
> + switch (n)
> + {
> + case 0: return x;
> + case 1 ... 63: return (u128) { .high = x.high >> n,
> + .low = (x.high << (64 - n)) | (x.low >> n) };
> + case 64 ...127: return (u128) { .high = 0, .low = x.high >> (n - 64) };
> + default: return (u128) { .high = 0, .low = 0 };
> + }
> +}
> +
> +static u128 u128_mul (u128 x, u128 y)
> +{
> + if (x.high == 0 && y.high == 0)
> + {
> + uint64_t x0 = x.low & MASK32;
> + uint64_t x1 = x.low >> 32;
> + uint64_t y0 = y.low & MASK32;
> + uint64_t y1 = y.low >> 32;
> + u128 x0y0 = { .high = 0, .low = x0 * y0 };
> + u128 x0y1 = { .high = 0, .low = x0 * y1 };
> + u128 x1y0 = { .high = 0, .low = x1 * y0 };
> + u128 x1y1 = { .high = 0, .low = x1 * y1 };
> + /* x0y0 + ((x0y1 + x1y0) << 32) + (x1y1 << 64) */
> + return u128_add (u128_add (x0y0, u128_lshift (u128_add (x0y1,
> + x1y0),
> + 32)),
> + u128_lshift (x1y1, 64));
maybe you can form x1y1 = { .high = x1 * y1, .low = 0 } to avoid the left
shift of x1y1
Paul
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 11/11] math: Use tanf from CORE-MATH
2024-11-12 0:23 ` Joseph Myers
@ 2024-11-12 17:42 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 34+ messages in thread
From: Adhemerval Zanella Netto @ 2024-11-12 17:42 UTC (permalink / raw)
To: Joseph Myers; +Cc: libc-alpha, Alexei Sibidanov, Paul Zimmermann
On 11/11/24 21:23, Joseph Myers wrote:
> On Mon, 11 Nov 2024, Adhemerval Zanella wrote:
>
>> +#ifdef __SIZEOF_INT128__
>> +typedef unsigned __int128 u128;
>> +# define u128_high(__x) (uint64_t)((__x) >> 64)
>> +# define u128_low(__x) (uint64_t)(__x)
>> +# define u128_from_u64(__x) (u128)(__x)
>> +# define u128_mul(__x, __y) (__x) * (__y)
>> +# define u128_add(__x, __y) (__x) + (__y)
>> +# define u128_lshift(__x, __y) (__x) << (__y)
>> +# define u128_rshift(__x, __y) (__x) >> (__y)
>> +#else
>> +typedef struct
>
> I'd suggest also having an option for the case of defined
> __BITINT_MAXWIDTH__ && __BITINT_MAXWIDTH__ >= 128, that uses unsigned
> _BitInt (128) in that case (and would look essentially like the unsigned
> __int128 case). (You can test that with GCC 14 or later on 32-bit x86.)
>
Sounds reasonable, I checked on some others ABIs and seems that not
everyone that supports _uint128 also support _BitInt (128).
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 11/11] math: Use tanf from CORE-MATH
2024-11-12 13:17 ` Paul Zimmermann
@ 2024-11-12 18:41 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 34+ messages in thread
From: Adhemerval Zanella Netto @ 2024-11-12 18:41 UTC (permalink / raw)
To: Paul Zimmermann; +Cc: libc-alpha, sibid
On 12/11/24 10:17, Paul Zimmermann wrote:
> Hi Adhemerval,
>
> some typos and possible improvements (this is not a review since I am in
> the "Signed-off-by" fields):
>
>> + (src/binary32/tan/tanf.cc in CORE-MATH)
>
> should be src/binary32/tan/tanf.c
Ack.
>
>> + - The code was adapted to use glibc code style and internal
>> + functions to handle errno, overflow, and underflow. It was changed
>> + to use an internal wrapper for 128 bit unsigned integer operation
>
> maybe "operations"?
>
Ack.
>> +/* Limited support for internal 128 bit integer, used on some math
>> + implementations. It uses compiler builtin type if supported, otherwise
>> + it is emulate. Only unsigned and some operations are currently supported:
>
> emulate -> emulated
>
Ack.
>> +
>> + - u128_t: the 128 bit unsigned type.
>> + - u128_high: return the high part of the number.
>> + - u128_low: return the low part of the number.
>> + - u128_from_u64: createa 128 bit number from a 64 bit one.
>
> create a
Ack.
>
>> + - u128_mul: multiple two 128 bit numbers.
>
> multiply
>
Ack.
>> + - u128_add: add two 128 bit numbers.
>> + - u128_lshift: left shift a number.
>> + - u128_rshift: right shift a number.
>> + */
>> +
>> +#ifdef __SIZEOF_INT128__
>> +typedef unsigned __int128 u128;
>> +# define u128_high(__x) (uint64_t)((__x) >> 64)
>> +# define u128_low(__x) (uint64_t)(__x)
>> +# define u128_from_u64(__x) (u128)(__x)
>> +# define u128_mul(__x, __y) (__x) * (__y)
>> +# define u128_add(__x, __y) (__x) + (__y)
>> +# define u128_lshift(__x, __y) (__x) << (__y)
>> +# define u128_rshift(__x, __y) (__x) >> (__y)
>> +#else
>> +typedef struct
>> +{
>> + uint64_t low;
>> + uint64_t high;
>> +} u128;
>> +
>> +# define u128_high(__x) (__x).high
>> +# define u128_low(__x) (__x).low
>> +
>> +# define u128_from_u64(__x) (u128){.low = (__x), .high = 0}
>> +
>> +# define TOPBIT (UINT64_C(1) << 63)
>> +# define MASK32 (UINT64_C(0xffffffff))
>> +
>> +static u128 u128_add (u128 x, u128 y)
>> +{
>> + uint64_t lower = (x.low & ~TOPBIT) + (y.low & ~TOPBIT);
>> + bool carry = (lower >> 63) + (x.low >> 63) + (y.low >> 63) > 1;
>> + return (u128) { .high = x.high + y.high + carry, .low = x.low + y.low };
>
> why not simply the following?
>
> bool carry = x.low + y.low < x.low;
> return (u128) { ... };
Because I forgot these are unsigned valued. Ack.
>
>> +}
>> +
>> +static u128 u128_lshift (u128 x, unsigned int n)
>> +{
>> + switch (n)
>> + {
>> + case 0: return x;
>> + case 1 ... 63: return (u128) { .high = (x.high << n) | (x.low >> (64 - n)),
>> + .low = x.low << n };
>> + case 64 ...127: return (u128) { .high = x.low << (n - 64), .low = 0};
>> + default: return (u128) { .high = 0, .low = 0 };
>> + }
>> +}
>> +
>> +static u128 u128_rshift (u128 x, unsigned int n)
>> +{
>> + switch (n)
>> + {
>> + case 0: return x;
>> + case 1 ... 63: return (u128) { .high = x.high >> n,
>> + .low = (x.high << (64 - n)) | (x.low >> n) };
>> + case 64 ...127: return (u128) { .high = 0, .low = x.high >> (n - 64) };
>> + default: return (u128) { .high = 0, .low = 0 };
>> + }
>> +}
>> +
>> +static u128 u128_mul (u128 x, u128 y)
>> +{
>> + if (x.high == 0 && y.high == 0)
>> + {
>> + uint64_t x0 = x.low & MASK32;
>> + uint64_t x1 = x.low >> 32;
>> + uint64_t y0 = y.low & MASK32;
>> + uint64_t y1 = y.low >> 32;
>> + u128 x0y0 = { .high = 0, .low = x0 * y0 };
>> + u128 x0y1 = { .high = 0, .low = x0 * y1 };
>> + u128 x1y0 = { .high = 0, .low = x1 * y0 };
>> + u128 x1y1 = { .high = 0, .low = x1 * y1 };
>> + /* x0y0 + ((x0y1 + x1y0) << 32) + (x1y1 << 64) */
>> + return u128_add (u128_add (x0y0, u128_lshift (u128_add (x0y1,
>> + x1y0),
>> + 32)),
>> + u128_lshift (x1y1, 64));
>
> maybe you can form x1y1 = { .high = x1 * y1, .low = 0 } to avoid the left
> shift of x1y1
Indeed, I will change it.
>
> Paul
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 01/11] benchtests: Add cbrtf benchmark
2024-11-11 13:45 ` [PATCH 01/11] benchtests: Add cbrtf benchmark Adhemerval Zanella
@ 2024-11-20 21:35 ` DJ Delorie
2024-11-21 13:09 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 34+ messages in thread
From: DJ Delorie @ 2024-11-20 21:35 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> Based on binary64 benchtests, with random inputs in [1,8].
> diff --git a/benchtests/Makefile b/benchtests/Makefile
> atan2 \
> atanh \
> cbrt \
> + cbrtf \
> ceil \
Ok.
cbrt is cube root, so inputs in [1,8] yield outputs in [1,2]
or inputs [0x1p+0,0x1p+3] outputs [0x1p+0,0x1p+1])
> diff --git a/benchtests/cbrtf-inputs b/benchtests/cbrtf-inputs
> +# Random inputs in [1,8]
This is not what's in this file. This is a file of inputs in [1,2]
> +## name: workload-random-1-8
> +0x1.e87c26p+0
> +0x1.a04bc6p+0
> +0x1.e1a296p+0
> . . .
> +0x1.eebde8p+0
> +0x1.889fb4p+0
> +0x1.9f3a22p+0
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 02/11] benchtests: Add erff benchmark
2024-11-11 13:45 ` [PATCH 02/11] benchtests: Add erff benchmark Adhemerval Zanella
@ 2024-11-20 21:38 ` DJ Delorie
0 siblings, 0 replies; 34+ messages in thread
From: DJ Delorie @ 2024-11-20 21:38 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> It is based on binary64 erf-inputs, with random inputs in [0,b=0x1.f5a888p+1]
> where b in the smallest number such that erff(b) rounds to 1 (to nearest).
> diff --git a/benchtests/Makefile b/benchtests/Makefile
> cosh \
> erf \
> erfc \
> + erff \
> exp \
Ok.
> diff --git a/benchtests/erff-inputs b/benchtests/erff-inputs
> +## args: float
> +## ret: float
> +## includes: math.h
> +# Random inputs in [0,b=0x1.f5a888p+1]
> +# where b in the smallest number such that erff(b) rounds to 1 (to nearest)
> +## name: workload-random
Ok.
LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 03/11] benchtests: Add erfcf benchmark
2024-11-11 13:45 ` [PATCH 03/11] benchtests: Add erfcf benchmark Adhemerval Zanella
@ 2024-11-20 21:41 ` DJ Delorie
0 siblings, 0 replies; 34+ messages in thread
From: DJ Delorie @ 2024-11-20 21:41 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> It is based on binary64 erfc-inputs, with random inputs in
> [0,b=0x1.41bbf6p+3] where b in the smallest number such that
> erfcf(b) rounds to 0 (to nearest).
> diff --git a/benchtests/Makefile b/benchtests/Makefile
> cosh \
> erf \
> erfc \
> + erfcf \
> erff \
Ok.
> diff --git a/benchtests/erfcf-inputs b/benchtests/erfcf-inputs
> +## args: float
> +## ret: float
> +## includes: math.h
> +# Random inputs in [0,b=0x1.41bbf6p+3]
> +# where b in the smallest number such that erfcf(b) rounds to 0 (to nearest)
> +## name: workload-random
> +0x1.599288p+1
> +0x1.6309e8p-1
> +0x1.c02778p+0
> . . .
> +0x1.931464p+2
> +0x1.ee1acp+0
> +0x1.1262c8p+2
Ok.
LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 04/11] benchtests: Add lgammaf benchmark
2024-11-11 13:45 ` [PATCH 04/11] benchtests: Add lgammaf benchmark Adhemerval Zanella
@ 2024-11-20 21:45 ` DJ Delorie
0 siblings, 0 replies; 34+ messages in thread
From: DJ Delorie @ 2024-11-20 21:45 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> Random inputs in the range [-20.0,20.0].
> diff --git a/benchtests/Makefile b/benchtests/Makefile
> j0 \
> j1 \
> lgamma \
> + lgammaf \
> llrint \
> llrintf \
Ok.
> diff --git a/benchtests/lgammaf-inputs b/benchtests/lgammaf-inputs
> +## args: float
> +## ret: float
> +## includes: math.h
> +# Random inputs in the range [-20.0,20.0]
> +## name: workload-random-m20-p20
> +-0x1.7eb52p+1
> +-0x1.69a06p+3
> +-0x1.a042ccp+3
> . . .
> +-0x1.be78a2p+3
> +-0x1.e1bf4ap+3
> +0x1.153b24p+4
Ok.
LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 05/11] benchtests: Add tanf benchmark
2024-11-11 13:45 ` [PATCH 05/11] benchtests: Add tanf benchmark Adhemerval Zanella
@ 2024-11-20 21:46 ` DJ Delorie
0 siblings, 0 replies; 34+ messages in thread
From: DJ Delorie @ 2024-11-20 21:46 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> diff --git a/benchtests/Makefile b/benchtests/Makefile
> sinh \
> sqrt \
> tan \
> + tanf \
> tanh \
Ok.
> diff --git a/benchtests/tanf-inputs b/benchtests/tanf-inputs
> +## args: float
> +## ret: float
> +## includes: math.h
> +# Random inputs in [-pi, pi]
> +## name: workload-random
> +-0x1.8d3888p+0
> +0x1.83287ep+1
> +-0x1.92ff9ep+0
> . . .
> +0x1.04fa16p+1
> +-0x1.019984p+0
> +0x1.2803d2p+1
Ok.
LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 06/11] math: Use cbrtf from CORE-MATH
2024-11-11 13:45 ` [PATCH 06/11] math: Use cbrtf from CORE-MATH Adhemerval Zanella
@ 2024-11-20 22:20 ` DJ Delorie
2024-11-21 13:12 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 34+ messages in thread
From: DJ Delorie @ 2024-11-20 22:20 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, sibid, Paul.Zimmermann
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> diff --git a/SHARED-FILES b/SHARED-FILES
> @@ -268,3 +268,7 @@ sysdeps/ieee754/flt-32/s_log10p1f.c
> (file src/binary32/log10p1/log10p1f.c in CORE-MATH)
> - The code was adapted to use glibc code style and internal
> functions to handle errno, overflow, and underflow.
> +sysdeps/ieee754/flt-32/s_cbrtf.c
> + (file src/binary32/cbrt/cbrtf.c in CORE-MATH)
> + - The code was adapted to use glibc code style and internal
> + functions to handle errno, overflow, and underflow.
Ok. Reminder to put an URL to CORE-MATH somewhere.
> diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulps
> index c523d45802..4979769b58 100644
> --- a/sysdeps/aarch64/libm-test-ulps
> +++ b/sysdeps/aarch64/libm-test-ulps
> @@ -474,7 +474,6 @@ ldouble: 2
>
> Function: "cbrt":
> double: 4
> -float: 1
> ldouble: 1
>
> Function: "cbrt_advsimd":
> @@ -483,7 +482,6 @@ float: 1
>
> Function: "cbrt_downward":
> double: 4
> -float: 1
> ldouble: 1
>
> Function: "cbrt_sve":
> @@ -492,12 +490,10 @@ float: 1
>
> Function: "cbrt_towardzero":
> double: 3
> -float: 1
> ldouble: 1
>
> Function: "cbrt_upward":
> double: 5
> -float: 1
> ldouble: 1
Ok.
> diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
> diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
> diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps
> diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
> diff --git a/sysdeps/csky/fpu/libm-test-ulps b/sysdeps/csky/fpu/libm-test-ulps
> diff --git a/sysdeps/csky/nofpu/libm-test-ulps b/sysdeps/csky/nofpu/libm-test-ulps
> diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
More of same, Ok.
> diff --git a/sysdeps/ieee754/flt-32/s_cbrtf.c b/sysdeps/ieee754/flt-32/s_cbrtf.c
> index 68b8b0ec37..5a7a9a952d 100644
> --- a/sysdeps/ieee754/flt-32/s_cbrtf.c
> +++ b/sysdeps/ieee754/flt-32/s_cbrtf.c
> @@ -1,61 +1,99 @@
> -/* Compute cubic root of float value.
> - Copyright (C) 1997-2024 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> +/* Correctly-rounded cubic root of binary32 value.
>
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> +Copyright (c) 2023, 2024 Alexei Sibidanov.
>
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> +The original version of this file was copied from the CORE-MATH
> +project (file src/binary32/cbrt/cbrtf.c, revision bc385c2).
>
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> +Permission is hereby granted, free of charge, to any person obtaining a copy
> +of this software and associated documentation files (the "Software"), to deal
> +in the Software without restriction, including without limitation the rights
> +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +copies of the Software, and to permit persons to whom the Software is
> +furnished to do so, subject to the following conditions:
>
> -#include <math.h>
> -#include <libm-alias-float.h>
> +The above copyright notice and this permission notice shall be included in all
> +copies or substantial portions of the Software.
>
> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +SOFTWARE.
> +*/
Ok.
> -#define CBRT2 1.2599210498948731648 /* 2^(1/3) */
> -#define SQR_CBRT2 1.5874010519681994748 /* 2^(2/3) */
> -
> -static const double factor[5] =
> -{
> - 1.0 / SQR_CBRT2,
> - 1.0 / CBRT2,
> - 1.0,
> - CBRT2,
> - SQR_CBRT2
> -};
> -
Ok.
> +#include <fenv.h>
> +#include <libm-alias-float.h>
> +#include <math.h>
> +#include <stdint.h>
> +#include "math_config.h"
Ok.
> float
> __cbrtf (float x)
> {
> - float xm, ym, u, t2;
> - int xe;
> -
> - /* Reduce X. XM now is an range 1.0 to 0.5. */
> - xm = __frexpf (fabsf (x), &xe);
> -
> - /* If X is not finite or is null return it (with raising exceptions
> - if necessary.
> - Note: *Our* version of `frexp' sets XE to zero if the argument is
> - Inf or NaN. This is not portable but faster. */
> - if (xe == 0 && fpclassify (x) <= FP_ZERO)
> - return x + x;
> -
> - u = (0.492659620528969547 + (0.697570460207922770
> - - 0.191502161678719066 * xm) * xm);
> -
> - t2 = u * u * u;
> -
> - ym = u * (t2 + 2.0 * xm) / (2.0 * t2 + xm) * factor[2 + xe % 3];
> -
> - return __ldexpf (x > 0.0 ? ym : -ym, xe / 3);
Ok.
> + static const union
> + {
> + double d;
> + uint64_t u;
> + } escale[3] =
> + {
> + { .d = 1.0 },
> + { .d = 0x1.428a2f98d728bp+0 }, /* 2^(1/3) */
> + { .d = 0x1.965fea53d6e3dp+0 }, /* 2^(2/3) */
> + };
> + uint32_t u = asuint (x);
> + uint32_t au = u << 1;
> + uint32_t sgn = u >> 31;
> + uint32_t e = au >> 24;
> + if (__glibc_unlikely (au < 1u << 24 || au >= 0xffu << 24))
> + {
> + if (au >= 0xffu << 24)
> + return x + x; /* inf, nan */
> + if (au == 0)
> + return x; /* +-0 */
> + int nz = __builtin_clz (au) - 7; /* subnormal */
> + au <<= nz;
> + e -= nz - 1;
> + }
Ok.
> + uint32_t mant = au & 0xffffff;
> + e += 899;
> + uint32_t et = e / 3, it = e % 3;
> + uint64_t isc = escale[it].u;
> + isc += (int64_t) (et - 342) << 52;
> + isc |= (int64_t) sgn << 63;
> + double cvt2 = asdouble (isc);
Ok.
> + static const double c[] =
> + {
> + 0x1.2319d352ea5d5p-1, 0x1.67ad8ee258d1ap-1, -0x1.9342edf9cbad9p-2,
> + 0x1.b6388fc510a75p-3, -0x1.6002455599e2fp-4, 0x1.7b096936192c4p-6,
> + -0x1.e5577187e8bf8p-9, 0x1.169ef81d6c34ep-12
> + };
> + double z = asdouble ((uint64_t) mant << 28 | UINT64_C(0x3ff) << 52);
> + double r0 = -0x1.9931c6c2d19d1p-6 / z;
> + double z2 = z * z;
> + double z4 = z2 * z2;
> + double f = ((c[0] + z * c[1]) + z2 * (c[2] + z * c[3]))
> + + z4 * ((c[4] + z * c[5]) + z2 * (c[6] + z * c[7])) + r0;
> + double r = f * cvt2;
> + float ub = r;
> + float lb = r - cvt2 * 1.4182e-9;
Ok.
> + if (__glibc_likely (ub == lb))
> + return ub;
Ok.
> + const double u0 = -0x1.ab16ec65d138fp+3;
> + double h = f * f * f - z;
> + f -= (f * r0 * u0) * h;
> + r = f * cvt2;
> + uint64_t cvt1 = asuint64 (r);
> + ub = r;
> + int64_t m0 = cvt1 << 19;
> + int64_t m1 = m0 >> 63;
Ok.
> + if (__glibc_unlikely ((m0 ^ m1) < (UINT64_C(1) << 31)))
> + {
> + cvt1 = (cvt1 + (UINT64_C(1) << 31)) & UINT64_C(0xffffffff00000000);
> + ub = asdouble (cvt1);
> + }
> + return ub;
> }
> libm_alias_float (__cbrt, cbrt)
Ok.
> diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps
> diff --git a/sysdeps/m68k/m680x0/fpu/libm-test-ulps b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
> diff --git a/sysdeps/microblaze/libm-test-ulps b/sysdeps/microblaze/libm-test-ulps
> diff --git a/sysdeps/mips/mips32/libm-test-ulps b/sysdeps/mips/mips32/libm-test-ulps
> diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
> diff --git a/sysdeps/nios2/libm-test-ulps b/sysdeps/nios2/libm-test-ulps
> diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps
> diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps
> diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
> diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
> diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps
> diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps
> diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
> diff --git a/sysdeps/sh/libm-test-ulps b/sysdeps/sh/libm-test-ulps
> diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
> diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
More of same. Ok.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 07/11] math: Split s_erfF in erff and erfc
2024-11-11 13:45 ` [PATCH 07/11] math: Split s_erfF in erff and erfc Adhemerval Zanella
@ 2024-11-20 22:40 ` DJ Delorie
2024-11-21 18:28 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 34+ messages in thread
From: DJ Delorie @ 2024-11-20 22:40 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> So we can eventually replace each implementation.
> diff --git a/math/Makefile b/math/Makefile
> s_ceilF \
> s_cosF \
> s_erfF \
> + s_erfcF \
> s_expm1F \
Ok, although 'c' sorts after 'F' in ascii, it sorts before in the
dictionary. I suspect in this case it's clearer to ignore the F suffix
as "not part of the name" wrt sorting, so s_erfc after s_erf.
> diff --git a/sysdeps/ieee754/dbl-64/s_erfc.c b/sysdeps/ieee754/dbl-64/s_erfc.c
> new file mode 100644
> +/* Not required. */
Ok.
> diff --git a/sysdeps/ieee754/float128/s_erfcf128.c b/sysdeps/ieee754/float128/s_erfcf128.c
> new file mode 100644
> +/* Not required. */
Ok.
> diff --git a/sysdeps/ieee754/flt-32/s_erfcf.c b/sysdeps/ieee754/flt-32/s_erfcf.c
> new file mode 100644
> index 0000000000..fdba278eff
> --- /dev/null
> +++ b/sysdeps/ieee754/flt-32/s_erfcf.c
> @@ -0,0 +1,173 @@
> +/* s_erfcf.c -- float version of s_erfc.c.
> + */
> . . .
> +}
> +libm_alias_float (__erfc, erfc)
Ok. This is just a copy of what's deleted below...
> diff --git a/sysdeps/ieee754/flt-32/s_erff.c b/sysdeps/ieee754/flt-32/s_erff.c
>
> static const float
> tiny = 1e-30,
> -half= 5.0000000000e-01, /* 0x3F000000 */
> one = 1.0000000000e+00, /* 0x3F800000 */
> -two = 2.0000000000e+00, /* 0x40000000 */
> - /* c = (subfloat)0.84506291151 */
> erx = 8.4506291151e-01, /* 0x3f58560b */
> /*
> * Coefficients for approximation to erf on [0,0.84375]
> @@ -156,77 +153,3 @@ float __erff(float x)
> }
> libm_alias_float (__erf, erf)
>
> -float __erfcf(float x)
> -{
> . . .
> -}
> -libm_alias_float (__erfc, erfc)
Ok.
> diff --git a/sysdeps/ieee754/ldbl-128/s_erfcl.c b/sysdeps/ieee754/ldbl-128/s_erfcl.c
> new file mode 100644
> index 0000000000..95d17c8c28
> --- /dev/null
> +++ b/sysdeps/ieee754/ldbl-128/s_erfcl.c
> @@ -0,0 +1 @@
> +/* Not required. */
Ok
> diff --git a/sysdeps/ieee754/ldbl-128ibm/s_erfcl.c b/sysdeps/ieee754/ldbl-128ibm/s_erfcl.c
> new file mode 100644
> index 0000000000..95d17c8c28
> --- /dev/null
> +++ b/sysdeps/ieee754/ldbl-128ibm/s_erfcl.c
> @@ -0,0 +1 @@
> +/* Not required. */
Ok
> diff --git a/sysdeps/ieee754/ldbl-96/s_erfcl.c b/sysdeps/ieee754/ldbl-96/s_erfcl.c
> new file mode 100644
> index 0000000000..95d17c8c28
> --- /dev/null
> +++ b/sysdeps/ieee754/ldbl-96/s_erfcl.c
> @@ -0,0 +1 @@
> +/* Not required. */
Ok.
LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 08/11] math: Use erff from CORE-MATH
2024-11-11 13:45 ` [PATCH 08/11] math: Use erff from CORE-MATH Adhemerval Zanella
@ 2024-11-20 23:10 ` DJ Delorie
0 siblings, 0 replies; 34+ messages in thread
From: DJ Delorie @ 2024-11-20 23:10 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, sibid, Paul.Zimmermann
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> The CORE-MATH implementation is correctly rounded (for any rounding mode)
> and shows better performance to the generic erff.
> diff --git a/SHARED-FILES b/SHARED-FILES
> index d367f4b62f..ccc5179f80 100644
> --- a/SHARED-FILES
> +++ b/SHARED-FILES
> @@ -272,3 +272,7 @@ sysdeps/ieee754/flt-32/s_cbrtf.c
> (file src/binary32/cbrt/cbrtf.c in CORE-MATH)
> - The code was adapted to use glibc code style and internal
> functions to handle errno, overflow, and underflow.
> +sysdeps/ieee754/flt-32/s_erff.c
> + (file src/binary32/erf/erff.c in CORE-MATH)
> + - The code was adapted to use glibc code style and internal
> + functions to handle errno, overflow, and underflow.
Ok.
> diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulps
> diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
> diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
> diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps
> diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
> diff --git a/sysdeps/csky/fpu/libm-test-ulps b/sysdeps/csky/fpu/libm-test-ulps
> diff --git a/sysdeps/csky/nofpu/libm-test-ulps b/sysdeps/csky/nofpu/libm-test-ulps
> diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
> diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
> diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
Ok.
> diff --git a/sysdeps/ieee754/flt-32/s_erff.c b/sysdeps/ieee754/flt-32/s_erff.c
> index 6c541dba23..762f160e9f 100644
> --- a/sysdeps/ieee754/flt-32/s_erff.c
> +++ b/sysdeps/ieee754/flt-32/s_erff.c
> @@ -1,155 +1,256 @@
> -/* s_erff.c -- float version of s_erf.c.
> - */
> +/* Correctly-rounded error function for binary32 value.
>
> -/*
> - * ====================================================
> - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
> - *
> - * Developed at SunPro, a Sun Microsystems, Inc. business.
> - * Permission to use, copy, modify, and distribute this
> - * software is freely granted, provided that this notice
> - * is preserved.
> - * ====================================================
> - */
> +Copyright (c) 2022-2024 Alexei Sibidanov.
>
> -#if defined(LIBM_SCCS) && !defined(lint)
> -static char rcsid[] = "$NetBSD: s_erff.c,v 1.4 1995/05/10 20:47:07 jtc Exp $";
> -#endif
> +This file is part of the CORE-MATH project
> +project (file src/binary32/erf/erff.c revision bc385c2).
> +
> +Permission is hereby granted, free of charge, to any person obtaining a copy
> +of this software and associated documentation files (the "Software"), to deal
> +in the Software without restriction, including without limitation the rights
> +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +copies of the Software, and to permit persons to whom the Software is
> +furnished to do so, subject to the following conditions:
> +
> +The above copyright notice and this permission notice shall be included in all
> +copies or substantial portions of the Software.
> +
> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +SOFTWARE.
> +*/
Ok.
> -#include <errno.h>
> -#include <float.h>
> #include <math.h>
> -#include <math-narrow-eval.h>
> -#include <math_private.h>
> -#include <math-underflow.h>
> +#include <stdint.h>
> #include <libm-alias-float.h>
> -#include <fix-int-fp-convert-zero.h>
> +#include "math_config.h"
Ok.
> -static const float
> -tiny = 1e-30,
> -one = 1.0000000000e+00, /* 0x3F800000 */
> -erx = 8.4506291151e-01, /* 0x3f58560b */
> -/*
> - * Coefficients for approximation to erf on [0,0.84375]
> - */
> -efx = 1.2837916613e-01, /* 0x3e0375d4 */
> -pp0 = 1.2837916613e-01, /* 0x3e0375d4 */
> -pp1 = -3.2504209876e-01, /* 0xbea66beb */
> -pp2 = -2.8481749818e-02, /* 0xbce9528f */
> -pp3 = -5.7702702470e-03, /* 0xbbbd1489 */
> -pp4 = -2.3763017452e-05, /* 0xb7c756b1 */
> -qq1 = 3.9791721106e-01, /* 0x3ecbbbce */
> -qq2 = 6.5022252500e-02, /* 0x3d852a63 */
> -qq3 = 5.0813062117e-03, /* 0x3ba68116 */
> -qq4 = 1.3249473704e-04, /* 0x390aee49 */
> -qq5 = -3.9602282413e-06, /* 0xb684e21a */
> -/*
> - * Coefficients for approximation to erf in [0.84375,1.25]
> - */
> -pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */
> -pa1 = 4.1485610604e-01, /* 0x3ed46805 */
> -pa2 = -3.7220788002e-01, /* 0xbebe9208 */
> -pa3 = 3.1834661961e-01, /* 0x3ea2fe54 */
> -pa4 = -1.1089469492e-01, /* 0xbde31cc2 */
> -pa5 = 3.5478305072e-02, /* 0x3d1151b3 */
> -pa6 = -2.1663755178e-03, /* 0xbb0df9c0 */
> -qa1 = 1.0642088205e-01, /* 0x3dd9f331 */
> -qa2 = 5.4039794207e-01, /* 0x3f0a5785 */
> -qa3 = 7.1828655899e-02, /* 0x3d931ae7 */
> -qa4 = 1.2617121637e-01, /* 0x3e013307 */
> -qa5 = 1.3637083583e-02, /* 0x3c5f6e13 */
> -qa6 = 1.1984500103e-02, /* 0x3c445aa3 */
> -/*
> - * Coefficients for approximation to erfc in [1.25,1/0.35]
> - */
> -ra0 = -9.8649440333e-03, /* 0xbc21a093 */
> -ra1 = -6.9385856390e-01, /* 0xbf31a0b7 */
> -ra2 = -1.0558626175e+01, /* 0xc128f022 */
> -ra3 = -6.2375331879e+01, /* 0xc2798057 */
> -ra4 = -1.6239666748e+02, /* 0xc322658c */
> -ra5 = -1.8460508728e+02, /* 0xc3389ae7 */
> -ra6 = -8.1287437439e+01, /* 0xc2a2932b */
> -ra7 = -9.8143291473e+00, /* 0xc11d077e */
> -sa1 = 1.9651271820e+01, /* 0x419d35ce */
> -sa2 = 1.3765776062e+02, /* 0x4309a863 */
> -sa3 = 4.3456588745e+02, /* 0x43d9486f */
> -sa4 = 6.4538726807e+02, /* 0x442158c9 */
> -sa5 = 4.2900814819e+02, /* 0x43d6810b */
> -sa6 = 1.0863500214e+02, /* 0x42d9451f */
> -sa7 = 6.5702495575e+00, /* 0x40d23f7c */
> -sa8 = -6.0424413532e-02, /* 0xbd777f97 */
> -/*
> - * Coefficients for approximation to erfc in [1/.35,28]
> - */
> -rb0 = -9.8649431020e-03, /* 0xbc21a092 */
> -rb1 = -7.9928326607e-01, /* 0xbf4c9dd4 */
> -rb2 = -1.7757955551e+01, /* 0xc18e104b */
> -rb3 = -1.6063638306e+02, /* 0xc320a2ea */
> -rb4 = -6.3756646729e+02, /* 0xc41f6441 */
> -rb5 = -1.0250950928e+03, /* 0xc480230b */
> -rb6 = -4.8351919556e+02, /* 0xc3f1c275 */
> -sb1 = 3.0338060379e+01, /* 0x41f2b459 */
> -sb2 = 3.2579251099e+02, /* 0x43a2e571 */
> -sb3 = 1.5367296143e+03, /* 0x44c01759 */
> -sb4 = 3.1998581543e+03, /* 0x4547fdbb */
> -sb5 = 2.5530502930e+03, /* 0x451f90ce */
> -sb6 = 4.7452853394e+02, /* 0x43ed43a7 */
> -sb7 = -2.2440952301e+01; /* 0xc1b38712 */
> -
Ok.
> -float __erff(float x)
> +float
> +__erff (float x)
> {
Ok.
> - int32_t hx,ix,i;
> - float R,S,P,Q,s,y,z,r;
> - GET_FLOAT_WORD(hx,x);
> - ix = hx&0x7fffffff;
> - if(ix>=0x7f800000) { /* erf(nan)=nan */
> - i = ((uint32_t)hx>>31)<<1;
> - return (float)(1-i)+one/x; /* erf(+-inf)=+-1 */
> - }
> -
> - if(ix < 0x3f580000) { /* |x|<0.84375 */
> - if(ix < 0x31800000) { /* |x|<2**-28 */
> - if (ix < 0x04000000)
> - {
> - /* Avoid spurious underflow. */
> - float ret = 0.0625f * (16.0f * x + (16.0f * efx) * x);
> - math_check_force_underflow (ret);
> - return ret;
> - }
> - return x + efx*x;
> - }
> - z = x*x;
> - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
> - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
> - y = r/s;
> - return x + x*y;
> - }
> - if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */
> - s = fabsf(x)-one;
> - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
> - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
> - if(hx>=0) return erx + P/Q; else return -erx - P/Q;
> - }
> - if (ix >= 0x40c00000) { /* inf>|x|>=6 */
> - if(hx>=0) return one-tiny; else return tiny-one;
> - }
> - x = fabsf(x);
> - s = one/(x*x);
> - if(ix< 0x4036DB6E) { /* |x| < 1/0.35 */
> - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
> - ra5+s*(ra6+s*ra7))))));
> - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
> - sa5+s*(sa6+s*(sa7+s*sa8)))))));
> - } else { /* |x| >= 1/0.35 */
> - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
> - rb5+s*rb6)))));
> - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
> - sb5+s*(sb6+s*sb7))))));
> - }
> - GET_FLOAT_WORD(ix,x);
> - SET_FLOAT_WORD(z,ix&0xfffff000);
> - r = __ieee754_expf(-z*z-(float)0.5625)*__ieee754_expf((z-x)*(z+x)+R/S);
> - if(hx>=0) return one-r/x; else return r/x-one;
Ok.
> + /* for 7 <= i < 63, C[i-7] is a degree-7 polynomial approximation of
> + erf(i/16+1/32+x) for -1/32 <= x <= 1/32 */
> + static const double C[56][8] = {
> + { 0x1.f86faa9428f9cp-2, 0x1.cfc41e36c7dfap-1, -0x1.b2c7dc53508b9p-2,
> + -0x1.5a9de93fa556ep-3, 0x1.731793dbb01b5p-3, 0x1.133e06426cf18p-6,
> + -0x1.a12a6289cafd8p-5, 0x1.717d6f1d6f557p-9 },
> . . .
> + { 0x1.fffffe2ba0ea5p-1, 0x1.d06ad6ecde88ep-22, -0x1.be46aa8edc9a1p-20,
> + 0x1.143860c7840b8p-18, -0x1.edaba78fb1260p-18, 0x1.52138a96ecee2p-17,
> + -0x1.6fca538c4e2eep-17, 0x1.434040640bcefp-17 },
> + { 0x1.fffffee3cc32cp-1, 0x1.1e1e857adb8ddp-22, -0x1.1769ce5f2a6e8p-20,
> + 0x1.5fe5d479b0543p-19, -0x1.405d865c94c2ap-18, 0x1.bfc94feb96afcp-18,
> + -0x1.f245d5f3e8358p-18, 0x1.c142456acf443p-18 },
> + };
Ok.
> + float ax = fabsf (x);
> + uint32_t ux = asuint (ax);
> + double s = x;
> + double z = ax;
Ok.
> + /* 0x407ad444 corresponds to x = 0x1.f5a888p+1 = 3.91921..., which is the
> + largest float such that erf(x) does not round to 1 (to nearest). */
> + if (__glibc_unlikely (ux > 0x407ad444u))
> + {
> + float os = copysignf (1.0f, x);
> + if (ux > (0xffu << 23))
> + return x + x; /* nan */
> + if (ux == (0xffu << 23))
> + return os; /* +-inf */
> + return os - 0x1p-25f * os;
> + }
Ok.
> + double v = floor (16.0 * z);
> + uint32_t i = 16.0f * ax;
> + /* 0x3ee00000 corresponds to x = 0.4375, for smaller x we have i < 7. */
> + if (__glibc_unlikely (ux < 0x3ee00000u))
> + {
> + static const double c[] =
> + {
> + 0x1.20dd750429b6dp+0, -0x1.812746b0375fbp-2,
> + 0x1.ce2f219fd6f45p-4, -0x1.b82ce2cbf0838p-6,
> + 0x1.565bb655adb85p-8, -0x1.c025bfc879c94p-11,
> + 0x1.f81718f61309cp-14, -0x1.cc67bd88f5867p-17
> + };
> + double z2 = s * s, z4 = z2 * z2, z8 = z4 * z4;
> + double c0 = c[0] + z2 * c[1];
> + double c2 = c[2] + z2 * c[3];
> + double c4 = c[4] + z2 * c[5];
> + double c6 = c[6] + z2 * c[7];
> + c0 += z4 * c2;
> + c4 += z4 * c6;
> + c0 += z8 * c4;
> + return s * c0;
> + }
Ok.
> + z = (z - 0.03125) - 0.0625 * v;
> + const double *c = C[i - 7];
> + double z2 = z * z, z4 = z2 * z2;
> + double c0 = c[0] + z * c[1];
> + double c2 = c[2] + z * c[3];
> + double c4 = c[4] + z * c[5];
> + double c6 = c[6] + z * c[7];
> + c0 += z2 * c2;
> + c4 += z2 * c6;
> + c0 += z4 * c4;
> + return copysign (c0, s);
> }
> libm_alias_float (__erf, erf)
> -
Ok.
> diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps
> diff --git a/sysdeps/m68k/m680x0/fpu/libm-test-ulps b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
> diff --git a/sysdeps/microblaze/libm-test-ulps b/sysdeps/microblaze/libm-test-ulps
> diff --git a/sysdeps/mips/mips32/libm-test-ulps b/sysdeps/mips/mips32/libm-test-ulps
> diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
> diff --git a/sysdeps/nios2/libm-test-ulps b/sysdeps/nios2/libm-test-ulps
> diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps
> diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps
> diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
> diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
> diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps
> diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps
> diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
> diff --git a/sysdeps/sh/libm-test-ulps b/sysdeps/sh/libm-test-ulps
> diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
> diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
Ok.
LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 09/11] math: Use erfcf from CORE-MATH
2024-11-11 13:45 ` [PATCH 09/11] math: Use erfcf " Adhemerval Zanella
@ 2024-11-21 1:35 ` DJ Delorie
2024-11-21 13:57 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 34+ messages in thread
From: DJ Delorie @ 2024-11-21 1:35 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, sibid, Paul.Zimmermann
A few minor nits about comments, two about table entries. Ok if those
are addressed, even if unchanged.
Reviewed-by: DJ Delorie <dj@redhat.com>
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> The CORE-MATH implementation is correctly rounded (for any rounding mode)
> and shows better performance to the generic erfcf.
> diff --git a/SHARED-FILES b/SHARED-FILES
> index ccc5179f80..e6e29bcadc 100644
> --- a/SHARED-FILES
> +++ b/SHARED-FILES
> @@ -276,3 +276,7 @@ sysdeps/ieee754/flt-32/s_erff.c
> (file src/binary32/erf/erff.c in CORE-MATH)
> - The code was adapted to use glibc code style and internal
> functions to handle errno, overflow, and underflow.
> +sysdeps/ieee754/flt-32/s_erfcf.c
> + (file src/binary32/erfc/erfcf.c in CORE-MATH)
> + - The code was adapted to use glibc code style and internal
> + functions to handle errno, overflow, and underflow.
Ok.
> diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
> diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
> diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps
> diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
> diff --git a/sysdeps/csky/fpu/libm-test-ulps b/sysdeps/csky/fpu/libm-test-ulps
> diff --git a/sysdeps/csky/nofpu/libm-test-ulps b/sysdeps/csky/nofpu/libm-test-ulps
> diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
> diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
> diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
Ok.
> diff --git a/sysdeps/ieee754/flt-32/s_erfcf.c b/sysdeps/ieee754/flt-32/s_erfcf.c
> index fdba278eff..6f8c7c6a57 100644
> --- a/sysdeps/ieee754/flt-32/s_erfcf.c
> +++ b/sysdeps/ieee754/flt-32/s_erfcf.c
> @@ -1,173 +1,185 @@
> -/* s_erfcf.c -- float version of s_erfc.c.
> - */
> +/* Correctly-rounded complementary error function for the binary32 format
>
> -/*
> - * ====================================================
> - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
> - *
> - * Developed at SunPro, a Sun Microsystems, Inc. business.
> - * Permission to use, copy, modify, and distribute this
> - * software is freely granted, provided that this notice
> - * is preserved.
> - * ====================================================
> - */
> +Copyright (c) 2023, 2024 Alexei Sibidanov.
>
> -#if defined(LIBM_SCCS) && !defined(lint)
> -static char rcsid[] = "$NetBSD: s_erff.c,v 1.4 1995/05/10 20:47:07 jtc Exp $";
> -#endif
> +This file is part of the CORE-MATH project
> +project (file src/binary32/erfc/erfcf.c revision bc385c2).
> +
> +Permission is hereby granted, free of charge, to any person obtaining a copy
> +of this software and associated documentation files (the "Software"), to deal
> +in the Software without restriction, including without limitation the rights
> +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +copies of the Software, and to permit persons to whom the Software is
> +furnished to do so, subject to the following conditions:
> +
> +The above copyright notice and this permission notice shall be included in all
> +copies or substantial portions of the Software.
> +
> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +SOFTWARE.
> +*/
Ok.
> #include <errno.h>
> -#include <fix-int-fp-convert-zero.h>
> -#include <libm-alias-float.h>
> -#include <math-narrow-eval.h>
> #include <math.h>
> -#include <math_private.h>
> -
> +#include <stdint.h>
> +#include <libm-alias-float.h>
> +#include "math_config.h"
Ok.
> -static const float
> -tiny = 1e-30,
> -half= 5.0000000000e-01, /* 0x3F000000 */
> -one = 1.0000000000e+00, /* 0x3F800000 */
> -two = 2.0000000000e+00, /* 0x40000000 */
> - /* c = (subfloat)0.84506291151 */
> -erx = 8.4506291151e-01, /* 0x3f58560b */
> -/*
> - * Coefficients for approximation to erf on [0,0.84375]
> - */
> -pp0 = 1.2837916613e-01, /* 0x3e0375d4 */
> -pp1 = -3.2504209876e-01, /* 0xbea66beb */
> -pp2 = -2.8481749818e-02, /* 0xbce9528f */
> -pp3 = -5.7702702470e-03, /* 0xbbbd1489 */
> -pp4 = -2.3763017452e-05, /* 0xb7c756b1 */
> -qq1 = 3.9791721106e-01, /* 0x3ecbbbce */
> -qq2 = 6.5022252500e-02, /* 0x3d852a63 */
> -qq3 = 5.0813062117e-03, /* 0x3ba68116 */
> -qq4 = 1.3249473704e-04, /* 0x390aee49 */
> -qq5 = -3.9602282413e-06, /* 0xb684e21a */
> -/*
> - * Coefficients for approximation to erf in [0.84375,1.25]
> - */
> -pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */
> -pa1 = 4.1485610604e-01, /* 0x3ed46805 */
> -pa2 = -3.7220788002e-01, /* 0xbebe9208 */
> -pa3 = 3.1834661961e-01, /* 0x3ea2fe54 */
> -pa4 = -1.1089469492e-01, /* 0xbde31cc2 */
> -pa5 = 3.5478305072e-02, /* 0x3d1151b3 */
> -pa6 = -2.1663755178e-03, /* 0xbb0df9c0 */
> -qa1 = 1.0642088205e-01, /* 0x3dd9f331 */
> -qa2 = 5.4039794207e-01, /* 0x3f0a5785 */
> -qa3 = 7.1828655899e-02, /* 0x3d931ae7 */
> -qa4 = 1.2617121637e-01, /* 0x3e013307 */
> -qa5 = 1.3637083583e-02, /* 0x3c5f6e13 */
> -qa6 = 1.1984500103e-02, /* 0x3c445aa3 */
> -/*
> - * Coefficients for approximation to erfc in [1.25,1/0.35]
> - */
> -ra0 = -9.8649440333e-03, /* 0xbc21a093 */
> -ra1 = -6.9385856390e-01, /* 0xbf31a0b7 */
> -ra2 = -1.0558626175e+01, /* 0xc128f022 */
> -ra3 = -6.2375331879e+01, /* 0xc2798057 */
> -ra4 = -1.6239666748e+02, /* 0xc322658c */
> -ra5 = -1.8460508728e+02, /* 0xc3389ae7 */
> -ra6 = -8.1287437439e+01, /* 0xc2a2932b */
> -ra7 = -9.8143291473e+00, /* 0xc11d077e */
> -sa1 = 1.9651271820e+01, /* 0x419d35ce */
> -sa2 = 1.3765776062e+02, /* 0x4309a863 */
> -sa3 = 4.3456588745e+02, /* 0x43d9486f */
> -sa4 = 6.4538726807e+02, /* 0x442158c9 */
> -sa5 = 4.2900814819e+02, /* 0x43d6810b */
> -sa6 = 1.0863500214e+02, /* 0x42d9451f */
> -sa7 = 6.5702495575e+00, /* 0x40d23f7c */
> -sa8 = -6.0424413532e-02, /* 0xbd777f97 */
> -/*
> - * Coefficients for approximation to erfc in [1/.35,28]
> - */
> -rb0 = -9.8649431020e-03, /* 0xbc21a092 */
> -rb1 = -7.9928326607e-01, /* 0xbf4c9dd4 */
> -rb2 = -1.7757955551e+01, /* 0xc18e104b */
> -rb3 = -1.6063638306e+02, /* 0xc320a2ea */
> -rb4 = -6.3756646729e+02, /* 0xc41f6441 */
> -rb5 = -1.0250950928e+03, /* 0xc480230b */
> -rb6 = -4.8351919556e+02, /* 0xc3f1c275 */
> -sb1 = 3.0338060379e+01, /* 0x41f2b459 */
> -sb2 = 3.2579251099e+02, /* 0x43a2e571 */
> -sb3 = 1.5367296143e+03, /* 0x44c01759 */
> -sb4 = 3.1998581543e+03, /* 0x4547fdbb */
> -sb5 = 2.5530502930e+03, /* 0x451f90ce */
> -sb6 = 4.7452853394e+02, /* 0x43ed43a7 */
> -sb7 = -2.2440952301e+01; /* 0xc1b38712 */
Ok.
> +static const double E[] =
> + {
> + 0x1p+0, 0x1.0163da9fb3335p+0, 0x1.02c9a3e778061p+0,
> + 0x1.04315e86e7f85p+0, 0x1.059b0d3158574p+0, 0x1.0706b29ddf6dep+0,
> + 0x1.0874518759bc8p+0, 0x1.09e3ecac6f383p+0, 0x1.0b5586cf9890fp+0,
> + 0x1.0cc922b7247f7p+0, 0x1.0e3ec32d3d1a2p+0, 0x1.0fb66affed31bp+0,
> + 0x1.11301d0125b51p+0, 0x1.12abdc06c31ccp+0, 0x1.1429aaea92dep+0,
> + 0x1.15a98c8a58e51p+0, 0x1.172b83c7d517bp+0, 0x1.18af9388c8deap+0,
> + 0x1.1a35beb6fcb75p+0, 0x1.1bbe084045cd4p+0, 0x1.1d4873168b9aap+0,
> + 0x1.1ed5022fcd91dp+0, 0x1.2063b88628cd6p+0, 0x1.21f49917ddc96p+0,
> + 0x1.2387a6e756238p+0, 0x1.251ce4fb2a63fp+0, 0x1.26b4565e27cddp+0,
> + 0x1.284dfe1f56381p+0, 0x1.29e9df51fdee1p+0, 0x1.2b87fd0dad99p+0,
> + 0x1.2d285a6e4030bp+0, 0x1.2ecafa93e2f56p+0, 0x1.306fe0a31b715p+0,
> + 0x1.32170fc4cd831p+0, 0x1.33c08b26416ffp+0, 0x1.356c55f929ff1p+0,
> + 0x1.371a7373aa9cbp+0, 0x1.38cae6d05d866p+0, 0x1.3a7db34e59ff7p+0,
> + 0x1.3c32dc313a8e5p+0, 0x1.3dea64c123422p+0, 0x1.3fa4504ac801cp+0,
> + 0x1.4160a21f72e2ap+0, 0x1.431f5d950a897p+0, 0x1.44e086061892dp+0,
> + 0x1.46a41ed1d0057p+0, 0x1.486a2b5c13cdp+0, 0x1.4a32af0d7d3dep+0,
> + 0x1.4bfdad5362a27p+0, 0x1.4dcb299fddd0dp+0, 0x1.4f9b2769d2ca7p+0,
> + 0x1.516daa2cf6642p+0, 0x1.5342b569d4f82p+0, 0x1.551a4ca5d920fp+0,
> + 0x1.56f4736b527dap+0, 0x1.58d12d497c7fdp+0, 0x1.5ab07dd485429p+0,
> + 0x1.5c9268a5946b7p+0, 0x1.5e76f15ad2148p+0, 0x1.605e1b976dc09p+0,
> + 0x1.6247eb03a5585p+0, 0x1.6434634ccc32p+0, 0x1.6623882552225p+0,
> + 0x1.68155d44ca973p+0, 0x1.6a09e667f3bcdp+0, 0x1.6c012750bdabfp+0,
> + 0x1.6dfb23c651a2fp+0, 0x1.6ff7df9519484p+0, 0x1.71f75e8ec5f74p+0,
> + 0x1.73f9a48a58174p+0, 0x1.75feb564267c9p+0, 0x1.780694fde5d3fp+0,
> + 0x1.7a11473eb0187p+0, 0x1.7c1ed0130c132p+0, 0x1.7e2f336cf4e62p+0,
> + 0x1.80427543e1a12p+0, 0x1.82589994cce13p+0, 0x1.8471a4623c7adp+0,
> + 0x1.868d99b4492edp+0, 0x1.88ac7d98a6699p+0, 0x1.8ace5422aa0dbp+0,
> + 0x1.8cf3216b5448cp+0, 0x1.8f1ae99157736p+0, 0x1.9145b0b91ffc6p+0,
> + 0x1.93737b0cdc5e5p+0, 0x1.95a44cbc8520fp+0, 0x1.97d829fde4e5p+0,
> + 0x1.9a0f170ca07bap+0, 0x1.9c49182a3f09p+0, 0x1.9e86319e32323p+0,
> + 0x1.a0c667b5de565p+0, 0x1.a309bec4a2d33p+0, 0x1.a5503b23e255dp+0,
> + 0x1.a799e1330b358p+0, 0x1.a9e6b5579fdbfp+0, 0x1.ac36bbfd3f37ap+0,
> + 0x1.ae89f995ad3adp+0, 0x1.b0e07298db666p+0, 0x1.b33a2b84f15fbp+0,
> + 0x1.b59728de5593ap+0, 0x1.b7f76f2fb5e47p+0, 0x1.ba5b030a1064ap+0,
> + 0x1.bcc1e904bc1d2p+0, 0x1.bf2c25bd71e09p+0, 0x1.c199bdd85529cp+0,
> + 0x1.c40ab5fffd07ap+0, 0x1.c67f12e57d14bp+0, 0x1.c8f6d9406e7b5p+0,
> + 0x1.cb720dcef9069p+0, 0x1.cdf0b555dc3fap+0, 0x1.d072d4a07897cp+0,
> + 0x1.d2f87080d89f2p+0, 0x1.d5818dcfba487p+0, 0x1.d80e316c98398p+0,
> + 0x1.da9e603db3285p+0, 0x1.dd321f301b46p+0, 0x1.dfc97337b9b5fp+0,
> + 0x1.e264614f5a129p+0, 0x1.e502ee78b3ff6p+0, 0x1.e7a51fbc74c83p+0,
> + 0x1.ea4afa2a490dap+0, 0x1.ecf482d8e67f1p+0, 0x1.efa1bee615a27p+0,
> + 0x1.f252b376bba97p+0, 0x1.f50765b6e454p+0, 0x1.f7bfdad9cbe14p+0,
> + 0x1.fa7c1819e90d8p+0, 0x1.fd3c22b8f71f1p+0
> + };
Ok.
> -float __erfcf(float x)
> +float
> +__erfcf (float xf)
> {
Ok.
> - int32_t hx,ix;
> - float R,S,P,Q,s,y,z,r;
> - GET_FLOAT_WORD(hx,x);
> - ix = hx&0x7fffffff;
> - if(ix>=0x7f800000) { /* erfc(nan)=nan */
> - /* erfc(+-inf)=0,2 */
> - float ret = (float)(((uint32_t)hx>>31)<<1)+one/x;
> - if (FIX_INT_FP_CONVERT_ZERO && ret == 0.0f)
> - return 0.0f;
> - return ret;
> - }
> -
> - if(ix < 0x3f580000) { /* |x|<0.84375 */
> - if(ix < 0x32800000) /* |x|<2**-26 */
> - return one-x;
> - z = x*x;
> - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
> - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
> - y = r/s;
> - if(hx < 0x3e800000) { /* x<1/4 */
> - return one-(x+x*y);
> - } else {
> - r = x*y;
> - r += (x-half);
> - return half - r ;
> - }
Ok.
> + float axf = fabsf (xf);
> + double axd = axf;
> + double x2 = axd * axd;
> + uint32_t t = asuint (xf);
> + unsigned int at = t & (~0u >> 1);
> + unsigned int sgn = t >> 31;
> + int64_t i = at > 0x40051000;
Ok.
> + /* for x < -0x1.ea8f94p+1, erfc(x) rounds to 2 (to nearest) */
> + if (__glibc_unlikely (t > 0xc07547ca))
> + { /* xf < -0x1.ea8f94p+1 */
> + if (__glibc_unlikely (t >= 0xff800000))
> + { /* -Inf or NaN */
> + if (t == 0xff800000)
> + return 2.0f; /* -Inf */
> + return xf + xf; /* NaN */
> }
> + return 2.0f - 0x1p-25f; /* rounds to 2 or nextbelow(2) */
> + }
Ok.
> - if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */
> - s = fabsf(x)-one;
> - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
> - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
> - if(hx>=0) {
> - z = one-erx; return z - P/Q;
> - } else {
> - z = erx+P/Q; return one+z;
> - }
Ok.
> + /* at is the absolute value of xf
> + for x >= 0x1.41bbf8p+3, erfc(x) < 2^-150, thus rounds to 0 or 2^-149 */
"round to 0 or 2^-149" is confusing. Does it mean "is less than 2^-149,
which is effectively zero" ? Or should we add ", depending on rounding
mode" to clarify?
> + if (__glibc_unlikely (at >= 0x4120ddfc))
> + { /* |xf| >= 0x1.41bbf8p+3 */
> + if (__glibc_unlikely (at >= 0x7f800000))
> + { /* +Inf or NaN */
> + if (at == 0x7f800000)
> + return 0.0f; /* +Inf */
> + return xf + xf; /* NaN */
> }
> + __set_errno (ERANGE);
> + return 0x1p-149f * 0.25f; /* 0 or 2^-149 wrt rounding */
> + }
So ", depending on rounding" then ;-)
> - if (ix < 0x41e00000) { /* |x|<28 */
> - x = fabsf(x);
> - s = one/(x*x);
> - if(ix< 0x4036DB6D) { /* |x| < 1/.35 ~ 2.857143*/
> - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
> - ra5+s*(ra6+s*ra7))))));
> - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
> - sa5+s*(sa6+s*(sa7+s*sa8)))))));
> - } else { /* |x| >= 1/.35 ~ 2.857143 */
> - if(hx<0&&ix>=0x40c00000) return two-tiny;/* x < -6 */
> - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
> - rb5+s*rb6)))));
> - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
> - sb5+s*(sb6+s*sb7))))));
> - }
> - GET_FLOAT_WORD(ix,x);
> - SET_FLOAT_WORD(z,ix&0xffffe000);
> - r = __ieee754_expf(-z*z-(float)0.5625)*
> - __ieee754_expf((z-x)*(z+x)+R/S);
> - if(hx>0) {
> - float ret = math_narrow_eval (r/x);
> - if (ret == 0)
> - __set_errno (ERANGE);
> - return ret;
> - } else
> - return two-r/x;
> - } else {
> - if(hx>0) {
> - __set_errno (ERANGE);
> - return tiny*tiny;
> - } else
> - return two-tiny;
Ok.
> + if (__glibc_unlikely (at <= 0x3db80000))
> + { /* |x| <= 0x1.7p-4 */
> + if (__glibc_unlikely (t == 0xb76c9f62))
> + return 0x1.00010ap+0f + 0x1p-25f; /* exceptional case */
> + /* for |x| <= 0x1.c5bf88p-26. erfc(x) rounds to 1 (to nearest) */
> + if (__glibc_unlikely (at <= 0x32e2dfc4))
> + { /* |x| <= 0x1.c5bf88p-26 */
> + if (__glibc_unlikely (at == 0))
> + return 1.0f;
> + static const float d[] = { -0x1p-26, 0x1p-25 };
> + return 1.0f + d[sgn];
> }
Ok.
> + /* around 0, erfc(x) behaves as 1 + (odd polynomial) */
> + static const double c[] =
> + {
> + 0x1.20dd750429b6dp+0, -0x1.812746b03610bp-2, 0x1.ce2f218831d2fp-4,
> + -0x1.b82c609607dcbp-6, 0x1.553af09b8008ep-8
> + };
> + double f0 = xf
> + * (c[0] + x2 * (c[1] + x2 * (c[2] + x2 * (c[3] + x2 * (c[4])))));
> + return 1.0 - f0;
> + }
> +
The comment says "1 + poly" but the code says "1 - poly". Which is correct?
(technically, both, I know, but they should be consistent)
> + /* now -0x1.ea8f94p+1 <= x <= 0x1.41bbf8p+3, with |x| > 0x1.7p-4 */
> + const double iln2 = 0x1.71547652b82fep+0;
> + const double ln2h = 0x1.62e42fefap-8;
> + const double ln2l = 0x1.cf79abd6f5dc8p-47;
> + uint64_t jt = asuint64 (fma (x2, iln2, -(1024 + 0x1p-8)));
> + int64_t j = (int64_t) (jt << 12) >> 48;
> + double S = asdouble (((j >> 7) + (0x3ff | sgn << 11)) << 52);
> + static const double ch[] =
> + {
> + -0x1.ffffffffff333p-2, 0x1.5555555556a14p-3, -0x1.55556666659b4p-5,
> + 0x1.1111074cc7b22p-7
> + };
> + double d = (x2 + ln2h * j) + ln2l * j;
> + double d2 = d * d;
> + double e0 = E[j & 127];
> + double f = d + d2 * ((ch[0] + d * ch[1]) + d2 * (ch[2] + d * ch[3]));
> + static const double ct[][16] =
> + {
> + {
> + 0x1.c162355429b28p-1, 3.70, 0x1.da951cece2b85p-2,
3.70 is not exactly representable in float32; the hex constant should be
used here.
> + -0x1.70ef6cff4bcc4p+0, 0x1.3d7f7b3d617dep+1, -0x1.9d0aa47537c51p+1,
> + 0x1.9754ea9a3fcb1p+1, -0x1.27a5453fcc015p+1, 0x1.1ef2e0531aebap+0,
> + -0x1.eca090f5a1c06p-3, -0x1.7a3cd173a063cp-4, 0x1.30fa68a68fdddp-4,
> + 0x1.55ad9a326993ap-10, -0x1.07e7b0bb39fbfp-6, 0x1.2328706c0e95p-10,
> + 0x1.d6aa0b7b19cfep-9
> + },
> + {
> + 0x1.137c8983f8516p+2, 2.95, 0x1.05b53aa241333p-3,
Same here.
> + -0x1.a3f53872bf87p-3, 0x1.de4c30742c9d5p-4, -0x1.cb24bfa591986p-5,
> + 0x1.666aec059ca5fp-6, -0x1.a61250eb26b0bp-8, 0x1.2b28b7924b34dp-10,
> + 0x1.41b13a9d45013p-15, -0x1.6dd5e8a273613p-14, 0x1.09ce8ea5e8da5p-16,
> + 0x1.33923b4102981p-18, -0x1.1dfd161e3f984p-19, -0x1.c87618fcae3b3p-23,
> + 0x1.e8a6ffa0ba2c7p-23
> + }
> + };
> + double z = (axd - ct[i][0]) / (axd + ct[i][1]);
> + double z2 = z * z, z4 = z2 * z2;
> + double z8 = z4 * z4;
> + const double *c = ct[i] + 3;
> + double s = (((c[0] + z * c[1]) + z2 * (c[2] + z * c[3]))
> + + z4 * ((c[4] + z * c[5]) + z2 * (c[6] + z * c[7])))
> + + z8 * (((c[8] + z * c[9]) + z2 * (c[10] + z * c[11])) + z4 * (c[12]));
> + s = ct[i][2] + z * s;
> + static const double off[] = { 0, 2 };
> + double r = (S * (e0 - f * e0)) * s;
> + double y = off[sgn] + r;
> + return y;
> }
> libm_alias_float (__erfc, erfc)
Ok.
> diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps
> diff --git a/sysdeps/m68k/m680x0/fpu/libm-test-ulps b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
> diff --git a/sysdeps/microblaze/libm-test-ulps b/sysdeps/microblaze/libm-test-ulps
> diff --git a/sysdeps/mips/mips32/libm-test-ulps b/sysdeps/mips/mips32/libm-test-ulps
> diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
> diff --git a/sysdeps/nios2/libm-test-ulps b/sysdeps/nios2/libm-test-ulps
> diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps
> diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps
> diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
> diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
> diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps
> diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps
> diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
> diff --git a/sysdeps/sh/libm-test-ulps b/sysdeps/sh/libm-test-ulps
> diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
> diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
Ok.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 10/11] math: Use lgammaf from CORE-MATH
2024-11-11 13:45 ` [PATCH 10/11] math: Use lgammaf " Adhemerval Zanella
@ 2024-11-21 2:38 ` DJ Delorie
0 siblings, 0 replies; 34+ messages in thread
From: DJ Delorie @ 2024-11-21 2:38 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, sibid, Paul.Zimmermann
LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> The CORE-MATH implementation is correctly rounded (for any rounding mode)
> and shows better performance to the generic lgammaf.
> diff --git a/SHARED-FILES b/SHARED-FILES
> index e6e29bcadc..033ce7f092 100644
> --- a/SHARED-FILES
> +++ b/SHARED-FILES
> @@ -280,3 +280,11 @@ sysdeps/ieee754/flt-32/s_erfcf.c
> (file src/binary32/erfc/erfcf.c in CORE-MATH)
> - The code was adapted to use glibc code style and internal
> functions to handle errno, overflow, and underflow.
> +sysdeps/ieee754/flt-32/e_lgammaf_r.c:
> + (file src/binary32/lgamma/lgammaf.c in CORE-MATH)
> + - change the function name from cr_lgammaf to __ieee754_lgammaf_r
> + - add "int *signgamp" as 2nd argument and add at the beginning:
> + if (signgamp != NULL) *signgamp = 1;
> + - remove the errno stuff (this is done by the wrapper)
> + - replace 0x1p127f * 0x1p127f by math_narrow_eval (x * 0x1p127f)
> + - add libm_alias_finite (__ieee754_lgammaf_r, __lgammaf_r) at the end
Ok.
> diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulps
> diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
> diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
> diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps
> diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
> diff --git a/sysdeps/csky/fpu/libm-test-ulps b/sysdeps/csky/fpu/libm-test-ulps
> diff --git a/sysdeps/csky/nofpu/libm-test-ulps b/sysdeps/csky/nofpu/libm-test-ulps
> diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
> diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
> diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
Ok.
> diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
> -/* e_lgammaf_r.c -- float version of e_lgamma_r.c.
> - */
> -
> -/*
> - * ====================================================
> - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
> - *
> - * Developed at SunPro, a Sun Microsystems, Inc. business.
> - * Permission to use, copy, modify, and distribute this
> - * software is freely granted, provided that this notice
> - * is preserved.
> - * ====================================================
> - */
> +/* Correctly-rounded logarithm of the absolute value of the gamma function
> + for binary32 value.
>
> +Copyright (c) 2023, 2024 Alexei Sibidanov.
> +
> +This file is part of the CORE-MATH project
> +project (file src/binary32/lgamma/lgammaf.c, revision bc385c2).
> +
> +Permission is hereby granted, free of charge, to any person obtaining a copy
> +of this software and associated documentation files (the "Software"), to deal
> +in the Software without restriction, including without limitation the rights
> +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +copies of the Software, and to permit persons to whom the Software is
> +furnished to do so, subject to the following conditions:
> +
> +The above copyright notice and this permission notice shall be included in all
> +copies or substantial portions of the Software.
> +
> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +SOFTWARE.
> +*/
> +
Ok.
> +/* Changes with respect to the original CORE-MATH code:
> + - removed the dealing with errno
> + (this is done in the wrapper math/w_lgammaf_compat2.c).
> + - usage of math_narrow_eval to deal with underflow/overflow.
> + - deal with signamp. */
> +
> +#include <array_length.h>
> +#include <stdint.h>
> #include <math.h>
> -#include <math-narrow-eval.h>
> -#include <math_private.h>
> -#include <libc-diag.h>
> #include <libm-alias-finite.h>
> +#include <limits.h>
> +#include <math-narrow-eval.h>
> +#include "math_config.h"
Ok.
> -static const float
> -two23= 8.3886080000e+06, /* 0x4b000000 */
> -half= 5.0000000000e-01, /* 0x3f000000 */
> -one = 1.0000000000e+00, /* 0x3f800000 */
> -pi = 3.1415927410e+00, /* 0x40490fdb */
> -a0 = 7.7215664089e-02, /* 0x3d9e233f */
> -a1 = 3.2246702909e-01, /* 0x3ea51a66 */
> -a2 = 6.7352302372e-02, /* 0x3d89f001 */
> -a3 = 2.0580807701e-02, /* 0x3ca89915 */
> -a4 = 7.3855509982e-03, /* 0x3bf2027e */
> -a5 = 2.8905137442e-03, /* 0x3b3d6ec6 */
> -a6 = 1.1927076848e-03, /* 0x3a9c54a1 */
> -a7 = 5.1006977446e-04, /* 0x3a05b634 */
> -a8 = 2.2086278477e-04, /* 0x39679767 */
> -a9 = 1.0801156895e-04, /* 0x38e28445 */
> -a10 = 2.5214456400e-05, /* 0x37d383a2 */
> -a11 = 4.4864096708e-05, /* 0x383c2c75 */
> -tc = 1.4616321325e+00, /* 0x3fbb16c3 */
> -tf = -1.2148628384e-01, /* 0xbdf8cdcd */
> -/* tt = -(tail of tf) */
> -tt = 6.6971006518e-09, /* 0x31e61c52 */
> -t0 = 4.8383611441e-01, /* 0x3ef7b95e */
> -t1 = -1.4758771658e-01, /* 0xbe17213c */
> -t2 = 6.4624942839e-02, /* 0x3d845a15 */
> -t3 = -3.2788541168e-02, /* 0xbd064d47 */
> -t4 = 1.7970675603e-02, /* 0x3c93373d */
> -t5 = -1.0314224288e-02, /* 0xbc28fcfe */
> -t6 = 6.1005386524e-03, /* 0x3bc7e707 */
> -t7 = -3.6845202558e-03, /* 0xbb7177fe */
> -t8 = 2.2596477065e-03, /* 0x3b141699 */
> -t9 = -1.4034647029e-03, /* 0xbab7f476 */
> -t10 = 8.8108185446e-04, /* 0x3a66f867 */
> -t11 = -5.3859531181e-04, /* 0xba0d3085 */
> -t12 = 3.1563205994e-04, /* 0x39a57b6b */
> -t13 = -3.1275415677e-04, /* 0xb9a3f927 */
> -t14 = 3.3552918467e-04, /* 0x39afe9f7 */
> -u0 = -7.7215664089e-02, /* 0xbd9e233f */
> -u1 = 6.3282704353e-01, /* 0x3f2200f4 */
> -u2 = 1.4549225569e+00, /* 0x3fba3ae7 */
> -u3 = 9.7771751881e-01, /* 0x3f7a4bb2 */
> -u4 = 2.2896373272e-01, /* 0x3e6a7578 */
> -u5 = 1.3381091878e-02, /* 0x3c5b3c5e */
> -v1 = 2.4559779167e+00, /* 0x401d2ebe */
> -v2 = 2.1284897327e+00, /* 0x4008392d */
> -v3 = 7.6928514242e-01, /* 0x3f44efdf */
> -v4 = 1.0422264785e-01, /* 0x3dd572af */
> -v5 = 3.2170924824e-03, /* 0x3b52d5db */
> -s0 = -7.7215664089e-02, /* 0xbd9e233f */
> -s1 = 2.1498242021e-01, /* 0x3e5c245a */
> -s2 = 3.2577878237e-01, /* 0x3ea6cc7a */
> -s3 = 1.4635047317e-01, /* 0x3e15dce6 */
> -s4 = 2.6642270386e-02, /* 0x3cda40e4 */
> -s5 = 1.8402845599e-03, /* 0x3af135b4 */
> -s6 = 3.1947532989e-05, /* 0x3805ff67 */
> -r1 = 1.3920053244e+00, /* 0x3fb22d3b */
> -r2 = 7.2193557024e-01, /* 0x3f38d0c5 */
> -r3 = 1.7193385959e-01, /* 0x3e300f6e */
> -r4 = 1.8645919859e-02, /* 0x3c98bf54 */
> -r5 = 7.7794247773e-04, /* 0x3a4beed6 */
> -r6 = 7.3266842264e-06, /* 0x36f5d7bd */
> -w0 = 4.1893854737e-01, /* 0x3ed67f1d */
> -w1 = 8.3333335817e-02, /* 0x3daaaaab */
> -w2 = -2.7777778450e-03, /* 0xbb360b61 */
> -w3 = 7.9365057172e-04, /* 0x3a500cfd */
> -w4 = -5.9518753551e-04, /* 0xba1c065c */
> -w5 = 8.3633989561e-04, /* 0x3a5b3dd2 */
> -w6 = -1.6309292987e-03; /* 0xbad5c4e8 */
> -
> -static const float zero= 0.0000000000e+00;
> -
Ok.
> -static float
> -sin_pif(float x)
> - float y,z;
> - int n,ix;
> -
> - GET_FLOAT_WORD(ix,x);
> - ix &= 0x7fffffff;
> -
> - if(ix<0x3e800000) return __sinf (pi*x);
> - y = -x; /* x is assume negative */
> -
> - /*
> - * argument reduction, make sure inexact flag not raised if input
> - * is an integer
> - */
> - z = floorf(y);
> - if(z!=y) { /* inexact anyway */
> - y *= (float)0.5;
> - y = (float)2.0*(y - floorf(y)); /* y = |x| mod 2.0 */
> - n = (int) (y*(float)4.0);
> - } else {
> - if(ix>=0x4b800000) {
> - y = zero; n = 0; /* y must be even */
> - } else {
> - if(ix<0x4b000000) z = y+two23; /* exact */
> - GET_FLOAT_WORD(n,z);
> - n &= 1;
> - y = n;
> - n<<= 2;
> - }
> - }
> - switch (n) {
> - case 0: y = __sinf (pi*y); break;
> - case 1:
> - case 2: y = __cosf (pi*((float)0.5-y)); break;
> - case 3:
> - case 4: y = __sinf (pi*(one-y)); break;
> - case 5:
> - case 6: y = -__cosf (pi*(y-(float)1.5)); break;
> - default: y = __sinf (pi*(y-(float)2.0)); break;
> - }
> - return -y;
Ok.
> +static double
> +as_r7 (double x, const double *c)
> {
> + return (((x - c[0]) * (x - c[1])) * ((x - c[2]) * (x - c[3])))
> + * (((x - c[4]) * (x - c[5])) * ((x - c[6])));
> }
Ok
> +static double
> +as_r8 (double x, const double *c)
> +{
> + return (((x - c[0]) * (x - c[1])) * ((x - c[2]) * (x - c[3])))
> + * (((x - c[4]) * (x - c[5])) * ((x - c[6]) * (x - c[7])));
> +}
Ok.
> +static double
> +as_sinpi (double x)
> +{
> + static const double c[] =
> + {
> + 0x1p+2, -0x1.de9e64df22ea4p+1, 0x1.472be122401f8p+0,
> + -0x1.d4fcd82df91bp-3, 0x1.9f05c97e0aab2p-6, -0x1.f3091c427b611p-10,
> + 0x1.b22c9bfdca547p-14, -0x1.15484325ef569p-18
> + };
> + x -= 0.5;
> + double x2 = x * x, x4 = x2 * x2, x8 = x4 * x4;
> + return (0.25 - x2)
> + * ((c[0] + x2 * c[1]) + x4 * (c[2] + x2 * c[3])
> + + x8 * ((c[4] + x2 * c[5]) + x4 * (c[6] + x2 * c[7])));
> +}
Ok.
> +static double
> +as_ln (double x)
> +{
> + uint64_t t = asuint64 (x);
> + int e = (t >> 52) - 0x3ff;
> + static const double c[] =
> + {
> + 0x1.fffffffffff24p-1, -0x1.ffffffffd1d67p-2, 0x1.55555537802dep-2,
> + -0x1.ffffeca81b866p-3, 0x1.999611761d772p-3, -0x1.54f3e581b61bfp-3,
> + 0x1.1e642b4cb5143p-3, -0x1.9115a5af1e1edp-4
> + };
> + static const double il[] =
> + {
> + 0x1.59caeec280116p-57, 0x1.f0a30c01162aap-5, 0x1.e27076e2af2ebp-4,
> + 0x1.5ff3070a793d6p-3, 0x1.c8ff7c79a9a2p-3, 0x1.1675cababa60fp-2,
> + 0x1.4618bc21c5ec2p-2, 0x1.739d7f6bbd007p-2, 0x1.9f323ecbf984dp-2,
> + 0x1.c8ff7c79a9a21p-2, 0x1.f128f5faf06ecp-2, 0x1.0be72e4252a83p-1,
> + 0x1.1e85f5e7040d1p-1, 0x1.307d7334f10bep-1, 0x1.41d8fe84672afp-1,
> + 0x1.52a2d265bc5abp-1
> + };
> + static const double ix[] =
> + {
> + 0x1p+0, 0x1.e1e1e1e1e1e1ep-1, 0x1.c71c71c71c71cp-1,
> + 0x1.af286bca1af28p-1, 0x1.999999999999ap-1, 0x1.8618618618618p-1,
> + 0x1.745d1745d1746p-1, 0x1.642c8590b2164p-1, 0x1.5555555555555p-1,
> + 0x1.47ae147ae147bp-1, 0x1.3b13b13b13b14p-1, 0x1.2f684bda12f68p-1,
> + 0x1.2492492492492p-1, 0x1.1a7b9611a7b96p-1, 0x1.1111111111111p-1,
> + 0x1.0842108421084p-1
> + };
> + int i = (t >> 48) & 0xf;
> + t = (t & (~UINT64_C(0) >> 12)) | (INT64_C(0x3ff) << 52);
> + double z = ix[i] * asdouble (t) - 1;
> + double z2 = z * z, z4 = z2 * z2;
> + return e * 0x1.62e42fefa39efp-1 + il[i]
> + + z * ((c[0] + z * c[1]) + z2 * (c[2] + z * c[3])
> + + z4 * ((c[4] + z * c[5]) + z2 * (c[6] + z * c[7])));
> +}
Ok.
> float
> -__ieee754_lgammaf_r(float x, int *signgamp)
> +__ieee754_lgammaf_r (float x, int *signgamp)
> {
Ok.
> - float t,y,z,nadj,p,p1,p2,p3,q,r,w;
> - int i,hx,ix;
> -
> - GET_FLOAT_WORD(hx,x);
> -
> - /* purge off +-inf, NaN, +-0, and negative arguments */
> - *signgamp = 1;
> - ix = hx&0x7fffffff;
> - if(__builtin_expect(ix>=0x7f800000, 0)) return x*x;
> - if(__builtin_expect(ix==0, 0))
> - {
> - if (hx < 0)
> - *signgamp = -1;
> - return one/fabsf(x);
> - }
> - if(__builtin_expect(ix<0x30800000, 0)) {
> - /* |x|<2**-30, return -log(|x|) */
> - if(hx<0) {
> - *signgamp = -1;
> - return -__ieee754_logf(-x);
> - } else return -__ieee754_logf(x);
Ok.
> + static const struct
> + {
> + float x;
> + float f;
> + float df;
> + } tb[] = {
> + { -0x1.efc2a2p+14, -0x1.222dbcp+18, -0x1p-7 },
> + { -0x1.627346p+7, -0x1.73235ep+9, -0x1p-16 },
> + { -0x1.08b14p+4, -0x1.f0cbe6p+4, -0x1p-21 },
> + { -0x1.69d628p+3, -0x1.0eac2ap+4, -0x1p-21 },
> + { -0x1.904902p+2, -0x1.65532cp+2, 0x1p-23 },
> + { -0x1.9272d2p+1, -0x1.170b98p-8, 0x1p-33 },
> + { -0x1.625edap+1, 0x1.6a6c4ap-5, -0x1p-30 },
> + { -0x1.5fc2aep+1, 0x1.c0a484p-11, -0x1p-36 },
> + { -0x1.5fb43ep+1, 0x1.5b697p-17, 0x1p-42 },
> + { -0x1.5fa20cp+1, -0x1.132f7ap-10, 0x1p-35 },
> + { -0x1.580c1ep+1, -0x1.5787c6p-4, 0x1p-29 },
> + { -0x1.3a7fcap+1, -0x1.e4cf24p-24, -0x1p-49 },
> + { -0x1.c2f04p-30, 0x1.43a6f6p+4, 0x1p-21 },
> + { -0x1.ade594p-30, 0x1.446ab2p+4, -0x1p-21 },
> + { -0x1.437e74p-40, 0x1.b7dec2p+4, -0x1p-21 },
> + { -0x1.d85bfep-43, 0x1.d31592p+4, -0x1p-21 },
> + { -0x1.f51c8ep-49, 0x1.0a572ap+5, -0x1p-20 },
> + { -0x1.108a5ap-66, 0x1.6d7b18p+5, -0x1p-20 },
> + { -0x1.ecf3fep-73, 0x1.8f8e5ap+5, -0x1p-20 },
> + { -0x1.25cb66p-123, 0x1.547a44p+6, -0x1p-19 },
> + { 0x1.ecf3fep-73, 0x1.8f8e5ap+5, -0x1p-20 },
> + { 0x1.108a5ap-66, 0x1.6d7b18p+5, -0x1p-20 },
> + { 0x1.a68bbcp-42, 0x1.c9c6e8p+4, 0x1p-21 },
> + { 0x1.ddfd06p-12, 0x1.ec5ba8p+2, -0x1p-23 },
> + { 0x1.f8a754p-9, 0x1.63acc2p+2, 0x1p-23 },
> + { 0x1.8d16b2p+5, 0x1.1e4b4ep+7, 0x1p-18 },
> + { 0x1.359e0ep+10, 0x1.d9ad02p+12, -0x1p-13 },
> + { 0x1.a82a2cp+13, 0x1.c38036p+16, 0x1p-9 },
> + { 0x1.62c646p+14, 0x1.9075bep+17, -0x1p-8 },
> + { 0x1.7f298p+31, 0x1.f44946p+35, -0x1p+10 },
> + { 0x1.a45ea4p+33, 0x1.25dcbcp+38, -0x1p+13 },
> + { 0x1.f9413ep+76, 0x1.9d5ab4p+82, -0x1p+57 },
> + { 0x1.dcbbaap+99, 0x1.fc5772p+105, 0x1p+80 },
> + { 0x1.58ace8p+112, 0x1.9e4f66p+118, -0x1p+93 },
> + { 0x1.87bdfp+115, 0x1.e465aep+121, 0x1p+96 },
> + };
Ok.
> + float fx = floor (x);
> + float ax = fabsf (x);
> + uint32_t t = asuint (ax);
> + if (__glibc_unlikely (t >= (0xffu << 23)))
> + {
> + *signgamp = 1;
> + if (t == (0xffu << 23))
> + return INFINITY;
> + return x + x; /* nan */
> + }
Ok.
> + if (__glibc_unlikely (fx == x))
> + {
> + if (x <= 0.0f)
> + {
> + *signgamp = asuint (x) >> 31 ? -1 : 1;
> + return 1.0f / 0.0f;
> }
Ok.
> - if(hx<0) {
> - if(ix>=0x4b000000) /* |x|>=2**23, must be -integer */
> - return fabsf (x)/zero;
> - if (ix > 0x40000000 /* X < 2.0f. */
> - && ix < 0x41700000 /* X > -15.0f. */)
> - return __lgamma_negf (x, signgamp);
> - t = sin_pif(x);
> - if(t==zero) return one/fabsf(t); /* -integer */
> - nadj = __ieee754_logf(pi/fabsf(t*x));
> - if(t<zero) *signgamp = -1;
> - x = -x;
Ok.
> + if (x == 1.0f || x == 2.0f)
> + {
> + *signgamp = 1;
> + return 0.0f;
> }
> + }
> +
Ok.
> + /* Check the value of fx to avoid a spurious invalid exception.
> + Note that for a binary32 |x| >= 2^23, x is necessarily an integer,
> + and we already dealed with negative integers, thus now:
> + -2^23 < x < +Inf and x is not a negative integer nor 0, 1, 2. */
> + int k;
> + if (__builtin_expect (fx >= 0x1p31f, 0))
> + k = INT_MAX;
> + else
> + k = fx;
> + *signgamp = 1 - (((k & (k >> 31)) & 1) << 1);
>
Ok.
> - /* purge off 1 and 2 */
> - if (ix==0x3f800000||ix==0x40000000) r = 0;
> - /* for x < 2.0 */
> - else if(ix<0x40000000) {
> - if(ix<=0x3f666666) { /* lgamma(x) = lgamma(x+1)-log(x) */
> - r = -__ieee754_logf(x);
> - if(ix>=0x3f3b4a20) {y = one-x; i= 0;}
> - else if(ix>=0x3e6d3308) {y= x-(tc-one); i=1;}
> - else {y = x; i=2;}
> - } else {
> - r = zero;
> - if(ix>=0x3fdda618) {y=(float)2.0-x;i=0;} /* [1.7316,2] */
> - else if(ix>=0x3F9da620) {y=x-tc;i=1;} /* [1.23,1.73] */
> - else {y=x-one;i=2;}
Ok.
> + double z = ax, f;
> + if (__glibc_unlikely (ax < 0x1.52p-1f))
> + {
> + static const double rn[] =
> + {
> + -0x1.505bdf4b65acp+4, -0x1.51c80eb47e068p+2,
> + 0x1.0000000007cb8p+0, -0x1.4ac529250a1fcp+1,
> + -0x1.a8c99dbe1621ap+0, -0x1.4abdcc74115eap+0,
> + -0x1.1b87fe5a5b923p+0, -0x1.05b8a4d47ff64p+0
> + };
> + const double c0 = 0x1.0fc0fad268c4dp+2;
> + static const double rd[] =
> + {
> + -0x1.4db2cfe9a5265p+5, -0x1.062e99d1c4f27p+3,
> + -0x1.c81bc2ecf25f6p+1, -0x1.108e55c10091bp+1,
> + -0x1.7dd25af0b83d4p+0, -0x1.36bf1880125fcp+0,
> + -0x1.1379fc8023d9cp+0, -0x1.03712e41525d2p+0
> + };
> + double s = x;
> + f = (c0 * s) * as_r8 (s, rn) / as_r8 (s, rd) - as_ln (z);
> + }
Ok.
> + else
> + {
> + if (ax > 0x1.afc1ap+1f)
> + {
> + if (__glibc_unlikely (x > 0x1.895f1cp+121f))
> + return math_narrow_eval (0x1p127f * 0x1p127f);
> + /* |x|>=2**23, must be -integer */
> + if (__glibc_unlikely (x < 0.0f && ax > 0x1p+23))
> + return ax / 0.0f;
> + double lz = as_ln (z);
> + f = (z - 0.5) * (lz - 1) + 0x1.acfe390c97d69p-2;
> + if (ax < 0x1.0p+20f)
> + {
> + double iz = 1.0 / z, iz2 = iz * iz;
> + if (ax > 1198.0f)
> + f += iz * (1. / 12.);
Ok.
> + else if (ax > 0x1.279a7p+6f)
> + {
> + static const double c[] =
> + {
> + 0x1.555555547fbadp-4, -0x1.6c0fd270c465p-9
> + };
> + f += iz * (c[0] + iz2 * c[1]);
> + }
Ok.
> + else if (ax > 0x1.555556p+3f)
> + {
> + static const double c[] =
> + {
> + 0x1.555555554de0bp-4, -0x1.6c16bdc45944fp-9,
> + 0x1.a0077f300ecb3p-11, -0x1.2e9cfff3b29c2p-11
> + };
> + double iz4 = iz2 * iz2;
> + f += iz * ((c[0] + iz2 * c[1]) + iz4 * (c[2] + iz2 * c[3]));
> + }
Ok.
> + else
> + {
> + static const double c[] =
> + {
> + 0x1.5555555551286p-4, -0x1.6c16c0e7c4cf4p-9,
> + 0x1.a0193267fe6f2p-11, -0x1.37e87ec19cb45p-11,
> + 0x1.b40011dfff081p-11, -0x1.c16c8946b19b6p-10,
> + 0x1.e9f47ace150d8p-9, -0x1.4f5843a71a338p-8
> + };
> + double iz4 = iz2 * iz2, iz8 = iz4 * iz4;
> + double p = ((c[0] + iz2 * c[1]) + iz4 * (c[2] + iz2 * c[3]))
> + + iz8 * ((c[4] + iz2 * c[5])
> + + iz4 * (c[6] + iz2 * c[7]));
> + f += iz * p;
> + }
> }
Ok.
> - switch(i) {
> - case 0:
> - z = y*y;
> - p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10))));
> - p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11)))));
> - p = y*p1+p2;
> - r += (p-(float)0.5*y); break;
> - case 1:
> - z = y*y;
> - w = z*y;
> - p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */
> - p2 = t1+w*(t4+w*(t7+w*(t10+w*t13)));
> - p3 = t2+w*(t5+w*(t8+w*(t11+w*t14)));
> - p = z*p1-(tt-w*(p2+y*p3));
> - r += (tf + p); break;
> - case 2:
> - p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5)))));
> - p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5))));
> - r += (-(float)0.5*y + p1/p2);
Ok.
> + if (x < 0.0f)
> + {
> + f = 0x1.250d048e7a1bdp+0 - f - lz;
> + double lp = as_ln (as_sinpi (x - fx));
> + f -= lp;
> }
> }
Ok.
> - else if(ix<0x41000000) { /* x < 8.0 */
> - i = (int)x;
> - t = zero;
> - y = x-(float)i;
> - p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6))))));
> - q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6)))));
> - r = half*y+p/q;
> - z = one; /* lgamma(1+s) = log(s) + lgamma(s) */
> - switch(i) {
> - case 7: z *= (y+(float)6.0); /* FALLTHRU */
> - case 6: z *= (y+(float)5.0); /* FALLTHRU */
> - case 5: z *= (y+(float)4.0); /* FALLTHRU */
> - case 4: z *= (y+(float)3.0); /* FALLTHRU */
> - case 3: z *= (y+(float)2.0); /* FALLTHRU */
> - r += __ieee754_logf(z); break;
Ok.
> + else
> + {
> + static const double rn[] =
> + {
> + -0x1.667923ff14df7p+5, -0x1.2d35f25ad8f64p+3,
> + -0x1.b8c9eab9d5bd3p+1, -0x1.7a4a97f494127p+0,
> + -0x1.3a6c8295b4445p-1, -0x1.da44e8b810024p-3,
> + -0x1.9061e81c77e4ap-5
> + };
> + if (x < 0.0f)
> + {
> + int ni = floorf (-2 * x);
> + if ((ni & 1) == 0 && ni == -2 * x)
> + return 1.0f / 0.0f;
> + }
> + const double c0 = 0x1.3cc0e6a0106b3p+2;
> + static const double rd[] =
> + {
> + -0x1.491a899e84c52p+6, -0x1.d202961b9e098p+3,
> + -0x1.4ced68c631ed6p+2, -0x1.2589eedf40738p+1,
> + -0x1.1302e3337271p+0, -0x1.c36b802f26dffp-2,
> + -0x1.3ded448acc39dp-3, -0x1.bffc491078eafp-6
> + };
> + f = (z - 1) * (z - 2) * c0 * as_r7 (z, rn) / as_r8 (z, rd);
Ok.
> + if (x < 0.0f)
> + {
> + if (__glibc_unlikely (t < 0x40301b93u && t > 0x402f95c2u))
> + {
> + double h = (x + 0x1.5fb410a1bd901p+1)
> + - 0x1.a19a96d2e6f85p-54;
> + double h2 = h * h;
> + double h4 = h2 * h2;
> + static const double c[] =
> + {
> + -0x1.ea12da904b18cp+0, 0x1.3267f3c265a54p+3,
> + -0x1.4185ac30cadb3p+4, 0x1.f504accc3f2e4p+5,
> + -0x1.8588444c679b4p+7, 0x1.43740491dc22p+9,
> + -0x1.12400ea23f9e6p+11, 0x1.dac829f365795p+12
> + };
> + f = h * ((c[0] + h * c[1]) + h2 * (c[2] + h * c[3])
> + + h4 * ((c[4] + h * c[5]) + h2 * (c[6] + h * c[7])));
> + }
Ok.
> + else if (__glibc_unlikely (t > 0x401ceccbu && t < 0x401d95cau))
> + {
> + double h = (x + 0x1.3a7fc9600f86cp+1)
> + + 0x1.55f64f98af8dp-55;
> + double h2 = h * h;
> + double h4 = h2 * h2;
> + static const double c[] =
> + {
> + 0x1.83fe966af535fp+0, 0x1.36eebb002f61ap+2,
> + 0x1.694a60589a0b3p+0, 0x1.1718d7aedb0b5p+3,
> + 0x1.733a045eca0d3p+2, 0x1.8d4297421205bp+4,
> + 0x1.7feea5fb29965p+4
> + };
> + f = h
> + * ((c[0] + h * c[1]) + h2 * (c[2] + h * c[3])
> + + h4 * ((c[4] + h * c[5]) + h2 * (c[6])));
> + }
Ok.
> + else if (__glibc_unlikely (t > 0x40492009u && t < 0x404940efu))
> + {
> + double h = (x + 0x1.9260dbc9e59afp+1)
> + + 0x1.f717cd335a7b3p-53;
> + double h2 = h * h;
> + double h4 = h2 * h2;
> + static const double c[] =
> + {
> + 0x1.f20a65f2fac55p+2, 0x1.9d4d297715105p+4,
> + 0x1.c1137124d5b21p+6, 0x1.267203d24de38p+9,
> + 0x1.99a63399a0b44p+11, 0x1.2941214faaf0cp+14,
> + 0x1.bb912c0c9cdd1p+16
> + };
> + f = h * ((c[0] + h * c[1]) + h2 * (c[2] + h * c[3])
> + + h4 * ((c[4] + h * c[5]) + h2 * (c[6])));
> + }
Ok.
> + else
> + {
> + f = 0x1.250d048e7a1bdp+0 - f;
> + double lp = as_ln (as_sinpi (x - fx) * z);
> + f -= lp;
> + }
Ok.
> }
> - /* 8.0 <= x < 2**26 */
> - } else if (ix < 0x4c800000) {
> - t = __ieee754_logf(x);
> - z = one/x;
> - y = z*z;
> - w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6)))));
> - r = (x-half)*(t-one)+w;
> - } else
> - /* 2**26 <= x <= inf */
> - r = math_narrow_eval (x*(__ieee754_logf(x)-one));
> - /* NADJ is set for negative arguments but not otherwise,
> - resulting in warnings that it may be used uninitialized
> - although in the cases where it is used it has always been
> - set. */
> - DIAG_PUSH_NEEDS_COMMENT;
> - DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
> - if(hx<0) r = nadj - r;
> - DIAG_POP_NEEDS_COMMENT;
> - return r;
Ok.
> + }
> + }
> +
> + uint64_t tl = (asuint64 (f) + 5) & 0xfffffff;
> + float r = f;
> + if (__glibc_unlikely (tl <= 31u))
> + {
> + t = asuint (x);
> + for (unsigned i = 0; i < array_length (tb); i++)
> + {
> + if (t == asuint (tb[i].x))
> + return tb[i].f + tb[i].df;
> + }
> + }
> + return r;
> }
> libm_alias_finite (__ieee754_lgammaf_r, __lgammaf_r)
Ok.
> diff --git a/sysdeps/ieee754/flt-32/lgamma_negf.c b/sysdeps/ieee754/flt-32/lgamma_negf.c
> -/* lgammaf expanding around zeros.
> - Copyright (C) 2015-2024 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> . . .
> -}
> +/* Not needed. */
Ok. I assume the file must continue to exist to mask a generic
implementation of it.
> diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps
> diff --git a/sysdeps/m68k/coldfire/fpu/libm-test-ulps b/sysdeps/m68k/coldfire/fpu/libm-test-ulps
> diff --git a/sysdeps/m68k/m680x0/fpu/libm-test-ulps b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
> diff --git a/sysdeps/microblaze/libm-test-ulps b/sysdeps/microblaze/libm-test-ulps
> diff --git a/sysdeps/mips/mips32/libm-test-ulps b/sysdeps/mips/mips32/libm-test-ulps
> diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
> diff --git a/sysdeps/nios2/libm-test-ulps b/sysdeps/nios2/libm-test-ulps
> diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps
> diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps
> diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
> diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
> diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps
> diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps
> diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
> diff --git a/sysdeps/sh/libm-test-ulps b/sysdeps/sh/libm-test-ulps
> diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
> diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
Ok.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 11/11] math: Use tanf from CORE-MATH
2024-11-11 13:45 ` [PATCH 11/11] math: Use tanf " Adhemerval Zanella
2024-11-12 0:23 ` Joseph Myers
2024-11-12 13:17 ` Paul Zimmermann
@ 2024-11-21 3:19 ` DJ Delorie
2024-11-21 14:08 ` Adhemerval Zanella Netto
2 siblings, 1 reply; 34+ messages in thread
From: DJ Delorie @ 2024-11-21 3:19 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, sibid, Paul.Zimmermann
Various comments that need fixing.
Otherwise LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> The CORE-MATH implementation is correctly rounded (for any rounding mode)
> and shows better performance to the generic tanf.
> diff --git a/SHARED-FILES b/SHARED-FILES
> index 033ce7f092..580e6b231a 100644
> --- a/SHARED-FILES
> +++ b/SHARED-FILES
> @@ -288,3 +288,9 @@ sysdeps/ieee754/flt-32/e_lgammaf_r.c:
> - remove the errno stuff (this is done by the wrapper)
> - replace 0x1p127f * 0x1p127f by math_narrow_eval (x * 0x1p127f)
> - add libm_alias_finite (__ieee754_lgammaf_r, __lgammaf_r) at the end
> +sysdeps/ieee754/flt-32/s_tanf.c:
> + (src/binary32/tan/tanf.cc in CORE-MATH)
> + - The code was adapted to use glibc code style and internal
> + functions to handle errno, overflow, and underflow. It was changed
> + to use an internal wrapper for 128 bit unsigned integer operation
> + for ABIs that do not support the type natively.
Ok.
> diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulps
> diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
> diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
> diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps
> diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
> diff --git a/sysdeps/csky/fpu/libm-test-ulps b/sysdeps/csky/fpu/libm-test-ulps
> diff --git a/sysdeps/csky/nofpu/libm-test-ulps b/sysdeps/csky/nofpu/libm-test-ulps
Ok.
> diff --git a/sysdeps/generic/math_int128.h b/sysdeps/generic/math_int128.h
If only unsigned is supported, this would make sense as math_uint128.h -
unless the plan is to add signed int128 in the future.
> +/* Internal 128 bit int support.
> + Copyright (C) 2024 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <https://www.gnu.org/licenses/>. */
> +
> +#ifndef _MATH_INT128_H
> +#define _MATH_INT128_H
> +
> +/* Limited support for internal 128 bit integer, used on some math
> + implementations. It uses compiler builtin type if supported, otherwise
> + it is emulate. Only unsigned and some operations are currently supported:
"it is emulated" (spelling)
> +
> + - u128_t: the 128 bit unsigned type.
> + - u128_high: return the high part of the number.
> + - u128_low: return the low part of the number.
> + - u128_from_u64: createa 128 bit number from a 64 bit one.
s/createa/create a/
> + - u128_mul: multiple two 128 bit numbers.
"multiply" (spelling)
> + - u128_add: add two 128 bit numbers.
> + - u128_lshift: left shift a number.
> + - u128_rshift: right shift a number.
> + */
Ok.
> +#ifdef __SIZEOF_INT128__
> +typedef unsigned __int128 u128;
> +# define u128_high(__x) (uint64_t)((__x) >> 64)
> +# define u128_low(__x) (uint64_t)(__x)
> +# define u128_from_u64(__x) (u128)(__x)
> +# define u128_mul(__x, __y) (__x) * (__y)
> +# define u128_add(__x, __y) (__x) + (__y)
> +# define u128_lshift(__x, __y) (__x) << (__y)
> +# define u128_rshift(__x, __y) (__x) >> (__y)
Ok.
> +#else
> +typedef struct
> +{
> + uint64_t low;
> + uint64_t high;
> +} u128;
> +
> +# define u128_high(__x) (__x).high
> +# define u128_low(__x) (__x).low
> +
> +# define u128_from_u64(__x) (u128){.low = (__x), .high = 0}
> +
> +# define TOPBIT (UINT64_C(1) << 63)
> +# define MASK32 (UINT64_C(0xffffffff))
Ok.
> +static u128 u128_add (u128 x, u128 y)
> +{
> + uint64_t lower = (x.low & ~TOPBIT) + (y.low & ~TOPBIT);
> + bool carry = (lower >> 63) + (x.low >> 63) + (y.low >> 63) > 1;
> + return (u128) { .high = x.high + y.high + carry, .low = x.low + y.low };
> +}
Ok.
> +static u128 u128_lshift (u128 x, unsigned int n)
> +{
> + switch (n)
> + {
> + case 0: return x;
> + case 1 ... 63: return (u128) { .high = (x.high << n) | (x.low >> (64 - n)),
> + .low = x.low << n };
> + case 64 ...127: return (u128) { .high = x.low << (n - 64), .low = 0};
> + default: return (u128) { .high = 0, .low = 0 };
> + }
> +}
Ok.
> +static u128 u128_rshift (u128 x, unsigned int n)
> +{
> + switch (n)
> + {
> + case 0: return x;
> + case 1 ... 63: return (u128) { .high = x.high >> n,
> + .low = (x.high << (64 - n)) | (x.low >> n) };
> + case 64 ...127: return (u128) { .high = 0, .low = x.high >> (n - 64) };
> + default: return (u128) { .high = 0, .low = 0 };
> + }
> +}
Ok.
> +static u128 u128_mul (u128 x, u128 y)
> +{
> + if (x.high == 0 && y.high == 0)
> + {
> + uint64_t x0 = x.low & MASK32;
> + uint64_t x1 = x.low >> 32;
> + uint64_t y0 = y.low & MASK32;
> + uint64_t y1 = y.low >> 32;
> + u128 x0y0 = { .high = 0, .low = x0 * y0 };
> + u128 x0y1 = { .high = 0, .low = x0 * y1 };
> + u128 x1y0 = { .high = 0, .low = x1 * y0 };
> + u128 x1y1 = { .high = 0, .low = x1 * y1 };
> + /* x0y0 + ((x0y1 + x1y0) << 32) + (x1y1 << 64) */
> + return u128_add (u128_add (x0y0, u128_lshift (u128_add (x0y1,
> + x1y0),
> + 32)),
> + u128_lshift (x1y1, 64));
> + }
Ok.
> + else
> + {
> + uint64_t x0 = x.low & MASK32;
> + uint64_t x1 = x.low >> 32;
> + uint64_t x2 = x.high & MASK32;
> + uint64_t x3 = x.high >> 32;
> + uint64_t y0 = y.low & MASK32;
> + uint64_t y1 = y.low >> 32;
> + uint64_t y2 = y.high & MASK32;
> + uint64_t y3 = y.high >> 32;
> + u128 x0y0 = { .high = 0, .low = x0 * y0 };
> + u128 x0y1 = { .high = 0, .low = x0 * y1 };
> + u128 x0y2 = { .high = 0, .low = x0 * y2 };
> + u128 x0y3 = { .high = 0, .low = x0 * y3 };
> + u128 x1y0 = { .high = 0, .low = x1 * y0 };
> + u128 x1y1 = { .high = 0, .low = x1 * y1 };
> + u128 x1y2 = { .high = 0, .low = x1 * y2 };
> + u128 x2y0 = { .high = 0, .low = x2 * y0 };
> + u128 x2y1 = { .high = 0, .low = x2 * y1 };
> + u128 x3y0 = { .high = 0, .low = x3 * y0 };
> + /* x0y0 + ((x0y1 + x1y0) << 32) + ((x0y2 + x1y1 + x2y0) << 64) +
> + ((x0y3 + x1y2 + x2y1 + x3y0) << 96) */
> + u128 r0 = u128_add (x0y0,
> + u128_lshift (u128_add (x0y1, x1y0),
> + 32));
> + u128 r1 = u128_add (u128_lshift (u128_add (u128_add (x0y2, x1y1), x2y0),
> + 64),
> + u128_lshift (u128_add (u128_add (x0y3, x1y2),
> + u128_add (x2y1, x3y0)),
> + 96));
> + return u128_add (r0, r1);
> + }
> +}
> +#endif /* __SIZEOF_INT128__ */
> +
> +#endif
Ok.
> diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
> diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
> diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
Ok.
> diff --git a/sysdeps/ieee754/flt-32/k_tanf.c b/sysdeps/ieee754/flt-32/k_tanf.c
> -/* k_tanf.c -- float version of k_tan.c
> - */
> . . .
> -}
> +/* Not needed. */
Ok.
> diff --git a/sysdeps/ieee754/flt-32/s_tanf.c b/sysdeps/ieee754/flt-32/s_tanf.c
> index ae6600bd57..41fd8fe496 100644
> --- a/sysdeps/ieee754/flt-32/s_tanf.c
> +++ b/sysdeps/ieee754/flt-32/s_tanf.c
> @@ -1,76 +1,176 @@
> -/* s_tanf.c -- float version of s_tan.c.
> - */
> +/* Correctly-rounded tangent of binary32 value.
>
> -/*
> - * ====================================================
> - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
> - *
> - * Developed at SunPro, a Sun Microsystems, Inc. business.
> - * Permission to use, copy, modify, and distribute this
> - * software is freely granted, provided that this notice
> - * is preserved.
> - * ====================================================
> - */
> +Copyright (c) 2022-2024 Alexei Sibidanov.
>
> -#if defined(LIBM_SCCS) && !defined(lint)
> -static char rcsid[] = "$NetBSD: s_tanf.c,v 1.4 1995/05/10 20:48:20 jtc Exp $";
> -#endif
> +The original version of this file was copied from the CORE-MATH
> +project (file src/binary32/tan/tanf.c, revision 59d21d7).
>
> -#include <errno.h>
> -#include <math.h>
> -#include <math_private.h>
> +Permission is hereby granted, free of charge, to any person obtaining a copy
> +of this software and associated documentation files (the "Software"), to deal
> +in the Software without restriction, including without limitation the rights
> +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +copies of the Software, and to permit persons to whom the Software is
> +furnished to do so, subject to the following conditions:
> +
> +The above copyright notice and this permission notice shall be included in all
> +copies or substantial portions of the Software.
> +
> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +SOFTWARE.
> +*/
Ok.
> +
> +#include <array_length.h>
> +#include <stdint.h>
> #include <libm-alias-float.h>
> -#include "s_sincosf.h"
> +#include "math_config.h"
> +#include <math_int128.h>
Ok.
> -/* Reduce range of X to a multiple of PI/2. The modulo result is between
> - -PI/4 and PI/4 and returned as a high part y[0] and a low part y[1].
> - The low bit in the return value indicates the first or 2nd half of tanf. */
> -static inline int32_t
> -rem_pio2f (float x, float *y)
Ok.
> +static inline double
> +rltl (float z, int *q)
Function needs a comment saying what its purpose is? I can't guess from
"rltl" nor from the contents or usage.
> {
> - double dx = x;
> - int n;
> - const sincos_t *p = &__sincosf_table[0];
Ok.
> + double x = z;
> + double idl = -0x1.b1bbead603d8bp-32 * x;
> + double idh = 0x1.45f306ep-1 * x;
> + double id = roundeven (idh);
> + *q = (int64_t) id;
> + return (idh - id) + idl;
> +}
Ok.
> - if (__glibc_likely (abstop12 (x) < abstop12 (120.0f)))
> - dx = reduce_fast (dx, p, &n);
> - else
Ok.
> +static double __attribute__ ((noinline))
> +rbig (uint32_t u, int *q)
Same here (comment needed). Radians Bigger? Rotate Bigwise? Rhythm
and Blues Ignores Generations?
> +{
> + static const uint64_t ipi[] =
> {
> - uint32_t xi = asuint (x);
> - int sign = xi >> 31;
> -
> - dx = reduce_large (xi, &n);
> - dx = sign ? -dx : dx;
Ok.
> + 0xfe5163abdebbc562, 0xdb6295993c439041,
> + 0xfc2757d1f534ddc0, 0xa2f9836e4e441529
> + };
> + int e = (u >> 23) & 0xff, i;
> + uint64_t m = (u & (~0u >> 9)) | 1 << 23;
> + u128 p0 = u128_mul (u128_from_u64 (m), u128_from_u64 (ipi[0]));
> + u128 p1 = u128_mul (u128_from_u64 (m), u128_from_u64 (ipi[1]));
> + p1 = u128_add (p1, u128_rshift (p0, 64));
> + u128 p2 = u128_mul (u128_from_u64 (m), u128_from_u64 (ipi[2]));
> + p2 = u128_add (p2, u128_rshift (p1, 64));
> + u128 p3 = u128_mul (u128_from_u64 (m), u128_from_u64 (ipi[3]));
> + p3 = u128_add (p3, u128_rshift (p2, 64));
> + uint64_t p3h = u128_high (p3);
> + uint64_t p3l = u128_low (p3);
> + uint64_t p2l = u128_low (p2);
> + uint64_t p1l = u128_low (p1);
> + int64_t a;
> + int k = e - 127, s = k - 23;
Ok.
> + /* in ctanf(), rbig() is called in the case 127+28 <= e < 0xff
> + thus 155 <= e <= 254, which yields 28 <= k <= 127 and 5 <= s <= 104 */
I'm guessing this comment goes with the lines above it, not the
comparison below? If so, please include a blank line here ;-)
> + if (s < 64)
> + {
> + i = p3h << s | p3l >> (64 - s);
> + a = p3l << s | p2l >> (64 - s);
> }
Ok.
> -
> - y[0] = dx;
> - y[1] = dx - y[0];
> - return n;
Ok.
> + else if (s == 64)
> + {
> + i = p3l;
> + a = p2l;
> + }
> + else
> + { /* s > 64 */
> + i = p3l << (s - 64) | p2l >> (128 - s);
> + a = p2l << (s - 64) | p1l >> (128 - s);
> + }
Ok.
> + int sgn = u;
> + sgn >>= 31;
Ok.
> + int64_t sm = a >> 63;
> + i -= sm;
> + double z = (a ^ sgn) * 0x1p-64;
> + i = (i ^ sgn) - sgn;
> + *q = i;
> + return z;
> }
Ok.
> -float __tanf(float x)
> +float
> +__tanf (float x)
> {
Ok.
> - float y[2],z=0.0;
> - int32_t n, ix;
> -
> - GET_FLOAT_WORD(ix,x);
> -
> - /* |x| ~< pi/4 */
> - ix &= 0x7fffffff;
> - if(ix <= 0x3f490fda) return __kernel_tanf(x,z,1);
> -
> - /* tan(Inf or NaN) is NaN */
> - else if (ix>=0x7f800000) {
> - if (ix==0x7f800000)
> - __set_errno (EDOM);
> - return x-x; /* NaN */
Ok.
> + uint32_t t = asuint (x);
> + int e = (t >> 23) & 0xff;
> + int i;
> + double z;
> + if (__glibc_likely (e < 127 + 28))
> + {
> + if (__glibc_unlikely (e < 115))
> + {
> + if (__glibc_unlikely (e < 102))
> + return fmaf (x, fabsf (x), x);
> + float x2 = x * x;
> + return fmaf (x, 0x1.555556p-2f * x2, x);
> }
Ok.
> -
> - /* argument reduction needed */
> - else {
> - n = rem_pio2f(x,y);
> - return __kernel_tanf(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even
> - -1 -- n odd */
Ok.
> + z = rltl (x, &i);
> + }
> + else if (e < 0xff)
> + z = rbig (t, &i);
> + else
> + {
> + if (t << 9)
> + return x + x; /* nan */
> + return __math_invalidf (x);
> + }
Ok.
> + double z2 = z * z;
> + double z4 = z2 * z2;
> + static const double cn[] =
> + {
> + 0x1.921fb54442d18p+0, -0x1.fd226e573289fp-2,
> + 0x1.b7a60c8dac9f6p-6, -0x1.725beb40f33e5p-13
> + };
> + static const double cd[] =
> + {
> + 0x1p+0, -0x1.2395347fb829dp+0,
> + 0x1.2313660f29c36p-3, -0x1.9a707ab98d1c1p-9
> + };
Ok.
> + static const double s[] = { 0, 1 };
> + double n = cn[0] + z2 * cn[1];
> + double n2 = cn[2] + z2 * cn[3];
> + n += z4 * n2;
> + double d = cd[0] + z2 * cd[1];
> + double d2 = cd[2] + z2 * cd[3];
> + d += z4 * d2;
> + n *= z;
> + double s0 = s[i & 1];
> + double s1 = s[1 - (i & 1)];
> + double r1 = (n * s1 - d * s0) / (n * s0 + d * s1);
Ok.
> + uint64_t tail = (asuint64 (r1) + 7) & (~UINT64_C(0) >> 35);
> + if (__glibc_unlikely (tail <= 14))
> + {
> + static const struct
> + {
> + float arg;
> + float rh;
> + float rl;
> + } st[] = {
> + { 0x1.143ec4p+0f, 0x1.ddf9f6p+0f, -0x1.891d24p-52f },
> + { 0x1.ada6aap+27f, 0x1.e80304p-3f, 0x1.419f46p-58f },
> + { 0x1.af61dap+48f, 0x1.60d1c8p-2f, -0x1.2d6c3ap-55f },
> + { 0x1.0088bcp+52f, 0x1.ca1edp+0f, 0x1.f6053p-53f },
> + { 0x1.f90dfcp+72f, 0x1.597f9cp-1f, 0x1.925978p-53f },
> + { 0x1.cc4e22p+85f, -0x1.f33584p+1f, 0x1.d7254ap-51f },
> + { 0x1.a6ce12p+86f, -0x1.c5612ep-1f, -0x1.26c33ep-53f },
> + { 0x1.6a0b76p+102f, -0x1.e42a1ep+0f, -0x1.1dc906p-52f },
> + };
> + uint32_t ax = t & (~0u >> 1);
> + uint32_t sgn = t >> 31;
> + for (int j = 0; j < array_length (st); j++)
> + {
> + if (__glibc_unlikely (asfloat (st[j].arg) == ax))
> + {
> + if (sgn)
> + return -st[j].rh - st[j].rl;
> + else
> + return st[j].rh + st[j].rl;
> + }
Ok.
> }
> + }
> + return r1;
> }
> libm_alias_float (__tan, tan)
Ok.
> diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps
> diff --git a/sysdeps/microblaze/libm-test-ulps b/sysdeps/microblaze/libm-test-ulps
> diff --git a/sysdeps/mips/mips32/libm-test-ulps b/sysdeps/mips/mips32/libm-test-ulps
> diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
> diff --git a/sysdeps/nios2/libm-test-ulps b/sysdeps/nios2/libm-test-ulps
> diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps
> diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps
> diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
> diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
> diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps
> diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps
> diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
> diff --git a/sysdeps/sh/libm-test-ulps b/sysdeps/sh/libm-test-ulps
> diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
> diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
Ok.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 01/11] benchtests: Add cbrtf benchmark
2024-11-20 21:35 ` DJ Delorie
@ 2024-11-21 13:09 ` Adhemerval Zanella Netto
2024-11-21 19:11 ` DJ Delorie
0 siblings, 1 reply; 34+ messages in thread
From: Adhemerval Zanella Netto @ 2024-11-21 13:09 UTC (permalink / raw)
To: DJ Delorie; +Cc: libc-alpha
On 20/11/24 18:35, DJ Delorie wrote:
> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
>> Based on binary64 benchtests, with random inputs in [1,8].
>
>> diff --git a/benchtests/Makefile b/benchtests/Makefile
>> atan2 \
>> atanh \
>> cbrt \
>> + cbrtf \
>> ceil \
>
> Ok.
>
> cbrt is cube root, so inputs in [1,8] yield outputs in [1,2]
> or inputs [0x1p+0,0x1p+3] outputs [0x1p+0,0x1p+1])
>
>> diff --git a/benchtests/cbrtf-inputs b/benchtests/cbrtf-inputs
>> +# Random inputs in [1,8]
>
> This is not what's in this file. This is a file of inputs in [1,2]
You are right, I copied from cbrt-inputs without verifying. I have
change to
diff --git a/benchtests/cbrtf-inputs b/benchtests/cbrtf-inputs
index 5a88a1f8dd..2178cfda7e 100644
--- a/benchtests/cbrtf-inputs
+++ b/benchtests/cbrtf-inputs
@@ -1,8 +1,8 @@
## args: float
## ret: float
## includes: math.h
-# Random inputs in [1,8]
-## name: workload-random-1-8
+# Random inputs in [1,2]
+## name: workload-random-1-2
0x1.e87c26p+0
0x1.a04bc6p+0
0x1.e1a296p+0
>
>> +## name: workload-random-1-8
>> +0x1.e87c26p+0
>> +0x1.a04bc6p+0
>> +0x1.e1a296p+0
>> . . .
>> +0x1.eebde8p+0
>> +0x1.889fb4p+0
>> +0x1.9f3a22p+0
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 06/11] math: Use cbrtf from CORE-MATH
2024-11-20 22:20 ` DJ Delorie
@ 2024-11-21 13:12 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 34+ messages in thread
From: Adhemerval Zanella Netto @ 2024-11-21 13:12 UTC (permalink / raw)
To: DJ Delorie; +Cc: libc-alpha, sibid, Paul.Zimmermann
On 20/11/24 19:20, DJ Delorie wrote:
> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
>> diff --git a/SHARED-FILES b/SHARED-FILES
>> @@ -268,3 +268,7 @@ sysdeps/ieee754/flt-32/s_log10p1f.c
>> (file src/binary32/log10p1/log10p1f.c in CORE-MATH)
>> - The code was adapted to use glibc code style and internal
>> functions to handle errno, overflow, and underflow.
>> +sysdeps/ieee754/flt-32/s_cbrtf.c
>> + (file src/binary32/cbrt/cbrtf.c in CORE-MATH)
>> + - The code was adapted to use glibc code style and internal
>> + functions to handle errno, overflow, and underflow.
>
> Ok. Reminder to put an URL to CORE-MATH somewhere.
I will do, thanks for remind me.
>
>> diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulps
>> index c523d45802..4979769b58 100644
>> --- a/sysdeps/aarch64/libm-test-ulps
>> +++ b/sysdeps/aarch64/libm-test-ulps
>> @@ -474,7 +474,6 @@ ldouble: 2
>>
>> Function: "cbrt":
>> double: 4
>> -float: 1
>> ldouble: 1
>>
>> Function: "cbrt_advsimd":
>> @@ -483,7 +482,6 @@ float: 1
>>
>> Function: "cbrt_downward":
>> double: 4
>> -float: 1
>> ldouble: 1
>>
>> Function: "cbrt_sve":
>> @@ -492,12 +490,10 @@ float: 1
>>
>> Function: "cbrt_towardzero":
>> double: 3
>> -float: 1
>> ldouble: 1
>>
>> Function: "cbrt_upward":
>> double: 5
>> -float: 1
>> ldouble: 1
>
> Ok.
>
>> diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
>> diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
>> diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps
>> diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
>> diff --git a/sysdeps/csky/fpu/libm-test-ulps b/sysdeps/csky/fpu/libm-test-ulps
>> diff --git a/sysdeps/csky/nofpu/libm-test-ulps b/sysdeps/csky/nofpu/libm-test-ulps
>> diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
>
> More of same, Ok.
>
>> diff --git a/sysdeps/ieee754/flt-32/s_cbrtf.c b/sysdeps/ieee754/flt-32/s_cbrtf.c
>> index 68b8b0ec37..5a7a9a952d 100644
>> --- a/sysdeps/ieee754/flt-32/s_cbrtf.c
>> +++ b/sysdeps/ieee754/flt-32/s_cbrtf.c
>> @@ -1,61 +1,99 @@
>> -/* Compute cubic root of float value.
>> - Copyright (C) 1997-2024 Free Software Foundation, Inc.
>> - This file is part of the GNU C Library.
>> +/* Correctly-rounded cubic root of binary32 value.
>>
>> - The GNU C Library is free software; you can redistribute it and/or
>> - modify it under the terms of the GNU Lesser General Public
>> - License as published by the Free Software Foundation; either
>> - version 2.1 of the License, or (at your option) any later version.
>> +Copyright (c) 2023, 2024 Alexei Sibidanov.
>>
>> - The GNU C Library is distributed in the hope that it will be useful,
>> - but WITHOUT ANY WARRANTY; without even the implied warranty of
>> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> - Lesser General Public License for more details.
>> +The original version of this file was copied from the CORE-MATH
>> +project (file src/binary32/cbrt/cbrtf.c, revision bc385c2).
>>
>> - You should have received a copy of the GNU Lesser General Public
>> - License along with the GNU C Library; if not, see
>> - <https://www.gnu.org/licenses/>. */
>> +Permission is hereby granted, free of charge, to any person obtaining a copy
>> +of this software and associated documentation files (the "Software"), to deal
>> +in the Software without restriction, including without limitation the rights
>> +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
>> +copies of the Software, and to permit persons to whom the Software is
>> +furnished to do so, subject to the following conditions:
>>
>> -#include <math.h>
>> -#include <libm-alias-float.h>
>> +The above copyright notice and this permission notice shall be included in all
>> +copies or substantial portions of the Software.
>>
>> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
>> +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>> +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
>> +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
>> +SOFTWARE.
>> +*/
>
> Ok.
>
>> -#define CBRT2 1.2599210498948731648 /* 2^(1/3) */
>> -#define SQR_CBRT2 1.5874010519681994748 /* 2^(2/3) */
>> -
>> -static const double factor[5] =
>> -{
>> - 1.0 / SQR_CBRT2,
>> - 1.0 / CBRT2,
>> - 1.0,
>> - CBRT2,
>> - SQR_CBRT2
>> -};
>> -
>
> Ok.
>
>> +#include <fenv.h>
>> +#include <libm-alias-float.h>
>> +#include <math.h>
>> +#include <stdint.h>
>> +#include "math_config.h"
>
> Ok.
>
>> float
>> __cbrtf (float x)
>> {
>> - float xm, ym, u, t2;
>> - int xe;
>> -
>> - /* Reduce X. XM now is an range 1.0 to 0.5. */
>> - xm = __frexpf (fabsf (x), &xe);
>> -
>> - /* If X is not finite or is null return it (with raising exceptions
>> - if necessary.
>> - Note: *Our* version of `frexp' sets XE to zero if the argument is
>> - Inf or NaN. This is not portable but faster. */
>> - if (xe == 0 && fpclassify (x) <= FP_ZERO)
>> - return x + x;
>> -
>> - u = (0.492659620528969547 + (0.697570460207922770
>> - - 0.191502161678719066 * xm) * xm);
>> -
>> - t2 = u * u * u;
>> -
>> - ym = u * (t2 + 2.0 * xm) / (2.0 * t2 + xm) * factor[2 + xe % 3];
>> -
>> - return __ldexpf (x > 0.0 ? ym : -ym, xe / 3);
>
> Ok.
>
>> + static const union
>> + {
>> + double d;
>> + uint64_t u;
>> + } escale[3] =
>> + {
>> + { .d = 1.0 },
>> + { .d = 0x1.428a2f98d728bp+0 }, /* 2^(1/3) */
>> + { .d = 0x1.965fea53d6e3dp+0 }, /* 2^(2/3) */
>> + };
>> + uint32_t u = asuint (x);
>> + uint32_t au = u << 1;
>> + uint32_t sgn = u >> 31;
>> + uint32_t e = au >> 24;
>> + if (__glibc_unlikely (au < 1u << 24 || au >= 0xffu << 24))
>> + {
>> + if (au >= 0xffu << 24)
>> + return x + x; /* inf, nan */
>> + if (au == 0)
>> + return x; /* +-0 */
>> + int nz = __builtin_clz (au) - 7; /* subnormal */
>> + au <<= nz;
>> + e -= nz - 1;
>> + }
>
> Ok.
>
>> + uint32_t mant = au & 0xffffff;
>> + e += 899;
>> + uint32_t et = e / 3, it = e % 3;
>> + uint64_t isc = escale[it].u;
>> + isc += (int64_t) (et - 342) << 52;
>> + isc |= (int64_t) sgn << 63;
>> + double cvt2 = asdouble (isc);
>
> Ok.
>
>> + static const double c[] =
>> + {
>> + 0x1.2319d352ea5d5p-1, 0x1.67ad8ee258d1ap-1, -0x1.9342edf9cbad9p-2,
>> + 0x1.b6388fc510a75p-3, -0x1.6002455599e2fp-4, 0x1.7b096936192c4p-6,
>> + -0x1.e5577187e8bf8p-9, 0x1.169ef81d6c34ep-12
>> + };
>> + double z = asdouble ((uint64_t) mant << 28 | UINT64_C(0x3ff) << 52);
>> + double r0 = -0x1.9931c6c2d19d1p-6 / z;
>> + double z2 = z * z;
>> + double z4 = z2 * z2;
>> + double f = ((c[0] + z * c[1]) + z2 * (c[2] + z * c[3]))
>> + + z4 * ((c[4] + z * c[5]) + z2 * (c[6] + z * c[7])) + r0;
>> + double r = f * cvt2;
>> + float ub = r;
>> + float lb = r - cvt2 * 1.4182e-9;
>
> Ok.
>
>> + if (__glibc_likely (ub == lb))
>> + return ub;
>
> Ok.
>
>> + const double u0 = -0x1.ab16ec65d138fp+3;
>> + double h = f * f * f - z;
>> + f -= (f * r0 * u0) * h;
>> + r = f * cvt2;
>> + uint64_t cvt1 = asuint64 (r);
>> + ub = r;
>> + int64_t m0 = cvt1 << 19;
>> + int64_t m1 = m0 >> 63;
>
> Ok.
>
>> + if (__glibc_unlikely ((m0 ^ m1) < (UINT64_C(1) << 31)))
>> + {
>> + cvt1 = (cvt1 + (UINT64_C(1) << 31)) & UINT64_C(0xffffffff00000000);
>> + ub = asdouble (cvt1);
>> + }
>> + return ub;
>> }
>> libm_alias_float (__cbrt, cbrt)
>
> Ok.
>
>> diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps
>> diff --git a/sysdeps/m68k/m680x0/fpu/libm-test-ulps b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
>> diff --git a/sysdeps/microblaze/libm-test-ulps b/sysdeps/microblaze/libm-test-ulps
>> diff --git a/sysdeps/mips/mips32/libm-test-ulps b/sysdeps/mips/mips32/libm-test-ulps
>> diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
>> diff --git a/sysdeps/nios2/libm-test-ulps b/sysdeps/nios2/libm-test-ulps
>> diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps
>> diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps
>> diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
>> diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
>> diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps
>> diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps
>> diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
>> diff --git a/sysdeps/sh/libm-test-ulps b/sysdeps/sh/libm-test-ulps
>> diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
>> diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
>
> More of same. Ok.
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 09/11] math: Use erfcf from CORE-MATH
2024-11-21 1:35 ` DJ Delorie
@ 2024-11-21 13:57 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 34+ messages in thread
From: Adhemerval Zanella Netto @ 2024-11-21 13:57 UTC (permalink / raw)
To: DJ Delorie; +Cc: libc-alpha, sibid, Paul.Zimmermann
On 20/11/24 22:35, DJ Delorie wrote:
>
> A few minor nits about comments, two about table entries. Ok if those
> are addressed, even if unchanged.
Thanks, I believe Paul fixed all of your remark on CORE-MATH commit
d683c2ccdb511994ef481d7824b3c0f4425b2cd2 (below).
>
> Reviewed-by: DJ Delorie <dj@redhat.com>
>
> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
>> The CORE-MATH implementation is correctly rounded (for any rounding mode)
>> and shows better performance to the generic erfcf.
>
>> diff --git a/SHARED-FILES b/SHARED-FILES
>> index ccc5179f80..e6e29bcadc 100644
>> --- a/SHARED-FILES
>> +++ b/SHARED-FILES
>> @@ -276,3 +276,7 @@ sysdeps/ieee754/flt-32/s_erff.c
>> (file src/binary32/erf/erff.c in CORE-MATH)
>> - The code was adapted to use glibc code style and internal
>> functions to handle errno, overflow, and underflow.
>> +sysdeps/ieee754/flt-32/s_erfcf.c
>> + (file src/binary32/erfc/erfcf.c in CORE-MATH)
>> + - The code was adapted to use glibc code style and internal
>> + functions to handle errno, overflow, and underflow.
>
> Ok.
>
>> diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
>> diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
>> diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps
>> diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
>> diff --git a/sysdeps/csky/fpu/libm-test-ulps b/sysdeps/csky/fpu/libm-test-ulps
>> diff --git a/sysdeps/csky/nofpu/libm-test-ulps b/sysdeps/csky/nofpu/libm-test-ulps
>> diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
>> diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
>> diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
>
> Ok.
>
>> diff --git a/sysdeps/ieee754/flt-32/s_erfcf.c b/sysdeps/ieee754/flt-32/s_erfcf.c
>> index fdba278eff..6f8c7c6a57 100644
>> --- a/sysdeps/ieee754/flt-32/s_erfcf.c
>> +++ b/sysdeps/ieee754/flt-32/s_erfcf.c
>> @@ -1,173 +1,185 @@
>> -/* s_erfcf.c -- float version of s_erfc.c.
>> - */
>> +/* Correctly-rounded complementary error function for the binary32 format
>>
>> -/*
>> - * ====================================================
>> - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
>> - *
>> - * Developed at SunPro, a Sun Microsystems, Inc. business.
>> - * Permission to use, copy, modify, and distribute this
>> - * software is freely granted, provided that this notice
>> - * is preserved.
>> - * ====================================================
>> - */
>> +Copyright (c) 2023, 2024 Alexei Sibidanov.
>>
>> -#if defined(LIBM_SCCS) && !defined(lint)
>> -static char rcsid[] = "$NetBSD: s_erff.c,v 1.4 1995/05/10 20:47:07 jtc Exp $";
>> -#endif
>> +This file is part of the CORE-MATH project
>> +project (file src/binary32/erfc/erfcf.c revision bc385c2).
>> +
>> +Permission is hereby granted, free of charge, to any person obtaining a copy
>> +of this software and associated documentation files (the "Software"), to deal
>> +in the Software without restriction, including without limitation the rights
>> +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
>> +copies of the Software, and to permit persons to whom the Software is
>> +furnished to do so, subject to the following conditions:
>> +
>> +The above copyright notice and this permission notice shall be included in all
>> +copies or substantial portions of the Software.
>> +
>> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
>> +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>> +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
>> +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
>> +SOFTWARE.
>> +*/
>
> Ok.
>
>> #include <errno.h>
>> -#include <fix-int-fp-convert-zero.h>
>> -#include <libm-alias-float.h>
>> -#include <math-narrow-eval.h>
>> #include <math.h>
>> -#include <math_private.h>
>> -
>> +#include <stdint.h>
>> +#include <libm-alias-float.h>
>> +#include "math_config.h"
>
> Ok.
>
>> -static const float
>> -tiny = 1e-30,
>> -half= 5.0000000000e-01, /* 0x3F000000 */
>> -one = 1.0000000000e+00, /* 0x3F800000 */
>> -two = 2.0000000000e+00, /* 0x40000000 */
>> - /* c = (subfloat)0.84506291151 */
>> -erx = 8.4506291151e-01, /* 0x3f58560b */
>> -/*
>> - * Coefficients for approximation to erf on [0,0.84375]
>> - */
>> -pp0 = 1.2837916613e-01, /* 0x3e0375d4 */
>> -pp1 = -3.2504209876e-01, /* 0xbea66beb */
>> -pp2 = -2.8481749818e-02, /* 0xbce9528f */
>> -pp3 = -5.7702702470e-03, /* 0xbbbd1489 */
>> -pp4 = -2.3763017452e-05, /* 0xb7c756b1 */
>> -qq1 = 3.9791721106e-01, /* 0x3ecbbbce */
>> -qq2 = 6.5022252500e-02, /* 0x3d852a63 */
>> -qq3 = 5.0813062117e-03, /* 0x3ba68116 */
>> -qq4 = 1.3249473704e-04, /* 0x390aee49 */
>> -qq5 = -3.9602282413e-06, /* 0xb684e21a */
>> -/*
>> - * Coefficients for approximation to erf in [0.84375,1.25]
>> - */
>> -pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */
>> -pa1 = 4.1485610604e-01, /* 0x3ed46805 */
>> -pa2 = -3.7220788002e-01, /* 0xbebe9208 */
>> -pa3 = 3.1834661961e-01, /* 0x3ea2fe54 */
>> -pa4 = -1.1089469492e-01, /* 0xbde31cc2 */
>> -pa5 = 3.5478305072e-02, /* 0x3d1151b3 */
>> -pa6 = -2.1663755178e-03, /* 0xbb0df9c0 */
>> -qa1 = 1.0642088205e-01, /* 0x3dd9f331 */
>> -qa2 = 5.4039794207e-01, /* 0x3f0a5785 */
>> -qa3 = 7.1828655899e-02, /* 0x3d931ae7 */
>> -qa4 = 1.2617121637e-01, /* 0x3e013307 */
>> -qa5 = 1.3637083583e-02, /* 0x3c5f6e13 */
>> -qa6 = 1.1984500103e-02, /* 0x3c445aa3 */
>> -/*
>> - * Coefficients for approximation to erfc in [1.25,1/0.35]
>> - */
>> -ra0 = -9.8649440333e-03, /* 0xbc21a093 */
>> -ra1 = -6.9385856390e-01, /* 0xbf31a0b7 */
>> -ra2 = -1.0558626175e+01, /* 0xc128f022 */
>> -ra3 = -6.2375331879e+01, /* 0xc2798057 */
>> -ra4 = -1.6239666748e+02, /* 0xc322658c */
>> -ra5 = -1.8460508728e+02, /* 0xc3389ae7 */
>> -ra6 = -8.1287437439e+01, /* 0xc2a2932b */
>> -ra7 = -9.8143291473e+00, /* 0xc11d077e */
>> -sa1 = 1.9651271820e+01, /* 0x419d35ce */
>> -sa2 = 1.3765776062e+02, /* 0x4309a863 */
>> -sa3 = 4.3456588745e+02, /* 0x43d9486f */
>> -sa4 = 6.4538726807e+02, /* 0x442158c9 */
>> -sa5 = 4.2900814819e+02, /* 0x43d6810b */
>> -sa6 = 1.0863500214e+02, /* 0x42d9451f */
>> -sa7 = 6.5702495575e+00, /* 0x40d23f7c */
>> -sa8 = -6.0424413532e-02, /* 0xbd777f97 */
>> -/*
>> - * Coefficients for approximation to erfc in [1/.35,28]
>> - */
>> -rb0 = -9.8649431020e-03, /* 0xbc21a092 */
>> -rb1 = -7.9928326607e-01, /* 0xbf4c9dd4 */
>> -rb2 = -1.7757955551e+01, /* 0xc18e104b */
>> -rb3 = -1.6063638306e+02, /* 0xc320a2ea */
>> -rb4 = -6.3756646729e+02, /* 0xc41f6441 */
>> -rb5 = -1.0250950928e+03, /* 0xc480230b */
>> -rb6 = -4.8351919556e+02, /* 0xc3f1c275 */
>> -sb1 = 3.0338060379e+01, /* 0x41f2b459 */
>> -sb2 = 3.2579251099e+02, /* 0x43a2e571 */
>> -sb3 = 1.5367296143e+03, /* 0x44c01759 */
>> -sb4 = 3.1998581543e+03, /* 0x4547fdbb */
>> -sb5 = 2.5530502930e+03, /* 0x451f90ce */
>> -sb6 = 4.7452853394e+02, /* 0x43ed43a7 */
>> -sb7 = -2.2440952301e+01; /* 0xc1b38712 */
>
> Ok.
>
>> +static const double E[] =
>> + {
>> + 0x1p+0, 0x1.0163da9fb3335p+0, 0x1.02c9a3e778061p+0,
>> + 0x1.04315e86e7f85p+0, 0x1.059b0d3158574p+0, 0x1.0706b29ddf6dep+0,
>> + 0x1.0874518759bc8p+0, 0x1.09e3ecac6f383p+0, 0x1.0b5586cf9890fp+0,
>> + 0x1.0cc922b7247f7p+0, 0x1.0e3ec32d3d1a2p+0, 0x1.0fb66affed31bp+0,
>> + 0x1.11301d0125b51p+0, 0x1.12abdc06c31ccp+0, 0x1.1429aaea92dep+0,
>> + 0x1.15a98c8a58e51p+0, 0x1.172b83c7d517bp+0, 0x1.18af9388c8deap+0,
>> + 0x1.1a35beb6fcb75p+0, 0x1.1bbe084045cd4p+0, 0x1.1d4873168b9aap+0,
>> + 0x1.1ed5022fcd91dp+0, 0x1.2063b88628cd6p+0, 0x1.21f49917ddc96p+0,
>> + 0x1.2387a6e756238p+0, 0x1.251ce4fb2a63fp+0, 0x1.26b4565e27cddp+0,
>> + 0x1.284dfe1f56381p+0, 0x1.29e9df51fdee1p+0, 0x1.2b87fd0dad99p+0,
>> + 0x1.2d285a6e4030bp+0, 0x1.2ecafa93e2f56p+0, 0x1.306fe0a31b715p+0,
>> + 0x1.32170fc4cd831p+0, 0x1.33c08b26416ffp+0, 0x1.356c55f929ff1p+0,
>> + 0x1.371a7373aa9cbp+0, 0x1.38cae6d05d866p+0, 0x1.3a7db34e59ff7p+0,
>> + 0x1.3c32dc313a8e5p+0, 0x1.3dea64c123422p+0, 0x1.3fa4504ac801cp+0,
>> + 0x1.4160a21f72e2ap+0, 0x1.431f5d950a897p+0, 0x1.44e086061892dp+0,
>> + 0x1.46a41ed1d0057p+0, 0x1.486a2b5c13cdp+0, 0x1.4a32af0d7d3dep+0,
>> + 0x1.4bfdad5362a27p+0, 0x1.4dcb299fddd0dp+0, 0x1.4f9b2769d2ca7p+0,
>> + 0x1.516daa2cf6642p+0, 0x1.5342b569d4f82p+0, 0x1.551a4ca5d920fp+0,
>> + 0x1.56f4736b527dap+0, 0x1.58d12d497c7fdp+0, 0x1.5ab07dd485429p+0,
>> + 0x1.5c9268a5946b7p+0, 0x1.5e76f15ad2148p+0, 0x1.605e1b976dc09p+0,
>> + 0x1.6247eb03a5585p+0, 0x1.6434634ccc32p+0, 0x1.6623882552225p+0,
>> + 0x1.68155d44ca973p+0, 0x1.6a09e667f3bcdp+0, 0x1.6c012750bdabfp+0,
>> + 0x1.6dfb23c651a2fp+0, 0x1.6ff7df9519484p+0, 0x1.71f75e8ec5f74p+0,
>> + 0x1.73f9a48a58174p+0, 0x1.75feb564267c9p+0, 0x1.780694fde5d3fp+0,
>> + 0x1.7a11473eb0187p+0, 0x1.7c1ed0130c132p+0, 0x1.7e2f336cf4e62p+0,
>> + 0x1.80427543e1a12p+0, 0x1.82589994cce13p+0, 0x1.8471a4623c7adp+0,
>> + 0x1.868d99b4492edp+0, 0x1.88ac7d98a6699p+0, 0x1.8ace5422aa0dbp+0,
>> + 0x1.8cf3216b5448cp+0, 0x1.8f1ae99157736p+0, 0x1.9145b0b91ffc6p+0,
>> + 0x1.93737b0cdc5e5p+0, 0x1.95a44cbc8520fp+0, 0x1.97d829fde4e5p+0,
>> + 0x1.9a0f170ca07bap+0, 0x1.9c49182a3f09p+0, 0x1.9e86319e32323p+0,
>> + 0x1.a0c667b5de565p+0, 0x1.a309bec4a2d33p+0, 0x1.a5503b23e255dp+0,
>> + 0x1.a799e1330b358p+0, 0x1.a9e6b5579fdbfp+0, 0x1.ac36bbfd3f37ap+0,
>> + 0x1.ae89f995ad3adp+0, 0x1.b0e07298db666p+0, 0x1.b33a2b84f15fbp+0,
>> + 0x1.b59728de5593ap+0, 0x1.b7f76f2fb5e47p+0, 0x1.ba5b030a1064ap+0,
>> + 0x1.bcc1e904bc1d2p+0, 0x1.bf2c25bd71e09p+0, 0x1.c199bdd85529cp+0,
>> + 0x1.c40ab5fffd07ap+0, 0x1.c67f12e57d14bp+0, 0x1.c8f6d9406e7b5p+0,
>> + 0x1.cb720dcef9069p+0, 0x1.cdf0b555dc3fap+0, 0x1.d072d4a07897cp+0,
>> + 0x1.d2f87080d89f2p+0, 0x1.d5818dcfba487p+0, 0x1.d80e316c98398p+0,
>> + 0x1.da9e603db3285p+0, 0x1.dd321f301b46p+0, 0x1.dfc97337b9b5fp+0,
>> + 0x1.e264614f5a129p+0, 0x1.e502ee78b3ff6p+0, 0x1.e7a51fbc74c83p+0,
>> + 0x1.ea4afa2a490dap+0, 0x1.ecf482d8e67f1p+0, 0x1.efa1bee615a27p+0,
>> + 0x1.f252b376bba97p+0, 0x1.f50765b6e454p+0, 0x1.f7bfdad9cbe14p+0,
>> + 0x1.fa7c1819e90d8p+0, 0x1.fd3c22b8f71f1p+0
>> + };
>
> Ok.
>
>> -float __erfcf(float x)
>> +float
>> +__erfcf (float xf)
>> {
>
> Ok.
>
>> - int32_t hx,ix;
>> - float R,S,P,Q,s,y,z,r;
>> - GET_FLOAT_WORD(hx,x);
>> - ix = hx&0x7fffffff;
>> - if(ix>=0x7f800000) { /* erfc(nan)=nan */
>> - /* erfc(+-inf)=0,2 */
>> - float ret = (float)(((uint32_t)hx>>31)<<1)+one/x;
>> - if (FIX_INT_FP_CONVERT_ZERO && ret == 0.0f)
>> - return 0.0f;
>> - return ret;
>> - }
>> -
>> - if(ix < 0x3f580000) { /* |x|<0.84375 */
>> - if(ix < 0x32800000) /* |x|<2**-26 */
>> - return one-x;
>> - z = x*x;
>> - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
>> - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
>> - y = r/s;
>> - if(hx < 0x3e800000) { /* x<1/4 */
>> - return one-(x+x*y);
>> - } else {
>> - r = x*y;
>> - r += (x-half);
>> - return half - r ;
>> - }
>
> Ok.
>
>> + float axf = fabsf (xf);
>> + double axd = axf;
>> + double x2 = axd * axd;
>> + uint32_t t = asuint (xf);
>> + unsigned int at = t & (~0u >> 1);
>> + unsigned int sgn = t >> 31;
>> + int64_t i = at > 0x40051000;
>
> Ok.
>
>> + /* for x < -0x1.ea8f94p+1, erfc(x) rounds to 2 (to nearest) */
>> + if (__glibc_unlikely (t > 0xc07547ca))
>> + { /* xf < -0x1.ea8f94p+1 */
>> + if (__glibc_unlikely (t >= 0xff800000))
>> + { /* -Inf or NaN */
>> + if (t == 0xff800000)
>> + return 2.0f; /* -Inf */
>> + return xf + xf; /* NaN */
>> }
>> + return 2.0f - 0x1p-25f; /* rounds to 2 or nextbelow(2) */
>> + }
>
> Ok.
>
>> - if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */
>> - s = fabsf(x)-one;
>> - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
>> - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
>> - if(hx>=0) {
>> - z = one-erx; return z - P/Q;
>> - } else {
>> - z = erx+P/Q; return one+z;
>> - }
>
> Ok.
>
>> + /* at is the absolute value of xf
>> + for x >= 0x1.41bbf8p+3, erfc(x) < 2^-150, thus rounds to 0 or 2^-149 */
>
> "round to 0 or 2^-149" is confusing. Does it mean "is less than 2^-149,
> which is effectively zero" ? Or should we add ", depending on rounding
> mode" to clarify?
Paul has updated the comment to:
/* at is the absolute value of xf
for x >= 0x1.41bbf8p+3, erfc(x) < 2^-150, thus rounds to 0 or to 2^-149
depending on the rounding mode */
and I have update it as well.
>
>> + if (__glibc_unlikely (at >= 0x4120ddfc))
>> + { /* |xf| >= 0x1.41bbf8p+3 */
>> + if (__glibc_unlikely (at >= 0x7f800000))
>> + { /* +Inf or NaN */
>> + if (at == 0x7f800000)
>> + return 0.0f; /* +Inf */
>> + return xf + xf; /* NaN */
>> }
>> + __set_errno (ERANGE);
>> + return 0x1p-149f * 0.25f; /* 0 or 2^-149 wrt rounding */
>> + }
>
> So ", depending on rounding" then ;-)
Yes, Paul changed to:
/* 0x1p-149f * 0.25f rounds to 0 or 2^-149 depending on rounding */
>
>> - if (ix < 0x41e00000) { /* |x|<28 */
>> - x = fabsf(x);
>> - s = one/(x*x);
>> - if(ix< 0x4036DB6D) { /* |x| < 1/.35 ~ 2.857143*/
>> - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
>> - ra5+s*(ra6+s*ra7))))));
>> - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
>> - sa5+s*(sa6+s*(sa7+s*sa8)))))));
>> - } else { /* |x| >= 1/.35 ~ 2.857143 */
>> - if(hx<0&&ix>=0x40c00000) return two-tiny;/* x < -6 */
>> - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
>> - rb5+s*rb6)))));
>> - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
>> - sb5+s*(sb6+s*sb7))))));
>> - }
>> - GET_FLOAT_WORD(ix,x);
>> - SET_FLOAT_WORD(z,ix&0xffffe000);
>> - r = __ieee754_expf(-z*z-(float)0.5625)*
>> - __ieee754_expf((z-x)*(z+x)+R/S);
>> - if(hx>0) {
>> - float ret = math_narrow_eval (r/x);
>> - if (ret == 0)
>> - __set_errno (ERANGE);
>> - return ret;
>> - } else
>> - return two-r/x;
>> - } else {
>> - if(hx>0) {
>> - __set_errno (ERANGE);
>> - return tiny*tiny;
>> - } else
>> - return two-tiny;
>
> Ok.
>
>> + if (__glibc_unlikely (at <= 0x3db80000))
>> + { /* |x| <= 0x1.7p-4 */
>> + if (__glibc_unlikely (t == 0xb76c9f62))
>> + return 0x1.00010ap+0f + 0x1p-25f; /* exceptional case */
>> + /* for |x| <= 0x1.c5bf88p-26. erfc(x) rounds to 1 (to nearest) */
>> + if (__glibc_unlikely (at <= 0x32e2dfc4))
>> + { /* |x| <= 0x1.c5bf88p-26 */
>> + if (__glibc_unlikely (at == 0))
>> + return 1.0f;
>> + static const float d[] = { -0x1p-26, 0x1p-25 };
>> + return 1.0f + d[sgn];
>> }
>
> Ok.
>
>> + /* around 0, erfc(x) behaves as 1 + (odd polynomial) */
>> + static const double c[] =
>> + {
>> + 0x1.20dd750429b6dp+0, -0x1.812746b03610bp-2, 0x1.ce2f218831d2fp-4,
>> + -0x1.b82c609607dcbp-6, 0x1.553af09b8008ep-8
>> + };
>> + double f0 = xf
>> + * (c[0] + x2 * (c[1] + x2 * (c[2] + x2 * (c[3] + x2 * (c[4])))));
>> + return 1.0 - f0;
>> + }
>> +
>
> The comment says "1 + poly" but the code says "1 - poly". Which is correct?
> (technically, both, I know, but they should be consistent)
It is '1 - poyy', Paul has updated it to:
/* around 0, erfc(x) behaves as 1 - (odd polynomial) */
>
>> + /* now -0x1.ea8f94p+1 <= x <= 0x1.41bbf8p+3, with |x| > 0x1.7p-4 */
>> + const double iln2 = 0x1.71547652b82fep+0;
>> + const double ln2h = 0x1.62e42fefap-8;
>> + const double ln2l = 0x1.cf79abd6f5dc8p-47;
>> + uint64_t jt = asuint64 (fma (x2, iln2, -(1024 + 0x1p-8)));
>> + int64_t j = (int64_t) (jt << 12) >> 48;
>> + double S = asdouble (((j >> 7) + (0x3ff | sgn << 11)) << 52);
>> + static const double ch[] =
>> + {
>> + -0x1.ffffffffff333p-2, 0x1.5555555556a14p-3, -0x1.55556666659b4p-5,
>> + 0x1.1111074cc7b22p-7
>> + };
>> + double d = (x2 + ln2h * j) + ln2l * j;
>> + double d2 = d * d;
>> + double e0 = E[j & 127];
>> + double f = d + d2 * ((ch[0] + d * ch[1]) + d2 * (ch[2] + d * ch[3]));
>> + static const double ct[][16] =
>> + {
>> + {
>> + 0x1.c162355429b28p-1, 3.70, 0x1.da951cece2b85p-2,
>
> 3.70 is not exactly representable in float32; the hex constant should be
> used here.
Ack, it should be 0x1.d99999999999ap+1.
>
>> + -0x1.70ef6cff4bcc4p+0, 0x1.3d7f7b3d617dep+1, -0x1.9d0aa47537c51p+1,
>> + 0x1.9754ea9a3fcb1p+1, -0x1.27a5453fcc015p+1, 0x1.1ef2e0531aebap+0,
>> + -0x1.eca090f5a1c06p-3, -0x1.7a3cd173a063cp-4, 0x1.30fa68a68fdddp-4,
>> + 0x1.55ad9a326993ap-10, -0x1.07e7b0bb39fbfp-6, 0x1.2328706c0e95p-10,
>> + 0x1.d6aa0b7b19cfep-9
>> + },
>> + {
>> + 0x1.137c8983f8516p+2, 2.95, 0x1.05b53aa241333p-3,
>
> Same here.
Ack, it should be 0x1.799999999999ap+1.
>
>> + -0x1.a3f53872bf87p-3, 0x1.de4c30742c9d5p-4, -0x1.cb24bfa591986p-5,
>> + 0x1.666aec059ca5fp-6, -0x1.a61250eb26b0bp-8, 0x1.2b28b7924b34dp-10,
>> + 0x1.41b13a9d45013p-15, -0x1.6dd5e8a273613p-14, 0x1.09ce8ea5e8da5p-16,
>> + 0x1.33923b4102981p-18, -0x1.1dfd161e3f984p-19, -0x1.c87618fcae3b3p-23,
>> + 0x1.e8a6ffa0ba2c7p-23
>> + }
>> + };
>> + double z = (axd - ct[i][0]) / (axd + ct[i][1]);
>> + double z2 = z * z, z4 = z2 * z2;
>> + double z8 = z4 * z4;
>> + const double *c = ct[i] + 3;
>> + double s = (((c[0] + z * c[1]) + z2 * (c[2] + z * c[3]))
>> + + z4 * ((c[4] + z * c[5]) + z2 * (c[6] + z * c[7])))
>> + + z8 * (((c[8] + z * c[9]) + z2 * (c[10] + z * c[11])) + z4 * (c[12]));
>> + s = ct[i][2] + z * s;
>> + static const double off[] = { 0, 2 };
>> + double r = (S * (e0 - f * e0)) * s;
>> + double y = off[sgn] + r;
>> + return y;
>> }
>> libm_alias_float (__erfc, erfc)
>
> Ok.
>
>> diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps
>> diff --git a/sysdeps/m68k/m680x0/fpu/libm-test-ulps b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
>> diff --git a/sysdeps/microblaze/libm-test-ulps b/sysdeps/microblaze/libm-test-ulps
>> diff --git a/sysdeps/mips/mips32/libm-test-ulps b/sysdeps/mips/mips32/libm-test-ulps
>> diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
>> diff --git a/sysdeps/nios2/libm-test-ulps b/sysdeps/nios2/libm-test-ulps
>> diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps
>> diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps
>> diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
>> diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
>> diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps
>> diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps
>> diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
>> diff --git a/sysdeps/sh/libm-test-ulps b/sysdeps/sh/libm-test-ulps
>> diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
>> diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
>
> Ok.
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 11/11] math: Use tanf from CORE-MATH
2024-11-21 3:19 ` DJ Delorie
@ 2024-11-21 14:08 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 34+ messages in thread
From: Adhemerval Zanella Netto @ 2024-11-21 14:08 UTC (permalink / raw)
To: DJ Delorie; +Cc: libc-alpha, sibid, Paul.Zimmermann
On 21/11/24 00:19, DJ Delorie wrote:
>
> Various comments that need fixing.
>
> Otherwise LGTM
> Reviewed-by: DJ Delorie <dj@redhat.com>
>
> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
>> The CORE-MATH implementation is correctly rounded (for any rounding mode)
>> and shows better performance to the generic tanf.
>> diff --git a/SHARED-FILES b/SHARED-FILES
>> index 033ce7f092..580e6b231a 100644
>> --- a/SHARED-FILES
>> +++ b/SHARED-FILES
>> @@ -288,3 +288,9 @@ sysdeps/ieee754/flt-32/e_lgammaf_r.c:
>> - remove the errno stuff (this is done by the wrapper)
>> - replace 0x1p127f * 0x1p127f by math_narrow_eval (x * 0x1p127f)
>> - add libm_alias_finite (__ieee754_lgammaf_r, __lgammaf_r) at the end
>> +sysdeps/ieee754/flt-32/s_tanf.c:
>> + (src/binary32/tan/tanf.cc in CORE-MATH)
>> + - The code was adapted to use glibc code style and internal
>> + functions to handle errno, overflow, and underflow. It was changed
>> + to use an internal wrapper for 128 bit unsigned integer operation
>> + for ABIs that do not support the type natively.
>
> Ok.
>
>> diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulps
>> diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
>> diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
>> diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps
>> diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
>> diff --git a/sysdeps/csky/fpu/libm-test-ulps b/sysdeps/csky/fpu/libm-test-ulps
>> diff --git a/sysdeps/csky/nofpu/libm-test-ulps b/sysdeps/csky/nofpu/libm-test-ulps
>
> Ok.
>
>> diff --git a/sysdeps/generic/math_int128.h b/sysdeps/generic/math_int128.h
>
> If only unsigned is supported, this would make sense as math_uint128.h -
> unless the plan is to add signed int128 in the future.
No right now, I will change to math_uint128.h.
>
>> +/* Internal 128 bit int support.
>> + Copyright (C) 2024 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <https://www.gnu.org/licenses/>. */
>> +
>> +#ifndef _MATH_INT128_H
>> +#define _MATH_INT128_H
>> +
>> +/* Limited support for internal 128 bit integer, used on some math
>> + implementations. It uses compiler builtin type if supported, otherwise
>> + it is emulate. Only unsigned and some operations are currently supported:
>
> "it is emulated" (spelling)
Ack.
>
>> +
>> + - u128_t: the 128 bit unsigned type.
>> + - u128_high: return the high part of the number.
>> + - u128_low: return the low part of the number.
>> + - u128_from_u64: createa 128 bit number from a 64 bit one.
>
> s/createa/create a/
Ack.
>
>> + - u128_mul: multiple two 128 bit numbers.
>
> "multiply" (spelling)
Ack.
(Paul already has pointed out these ealier).
>
>> + - u128_add: add two 128 bit numbers.
>> + - u128_lshift: left shift a number.
>> + - u128_rshift: right shift a number.
>> + */
>
> Ok.
>
>> +#ifdef __SIZEOF_INT128__
>> +typedef unsigned __int128 u128;
>> +# define u128_high(__x) (uint64_t)((__x) >> 64)
>> +# define u128_low(__x) (uint64_t)(__x)
>> +# define u128_from_u64(__x) (u128)(__x)
>> +# define u128_mul(__x, __y) (__x) * (__y)
>> +# define u128_add(__x, __y) (__x) + (__y)
>> +# define u128_lshift(__x, __y) (__x) << (__y)
>> +# define u128_rshift(__x, __y) (__x) >> (__y)
>
> Ok.
>
>> +#else
>> +typedef struct
>> +{
>> + uint64_t low;
>> + uint64_t high;
>> +} u128;
>> +
>> +# define u128_high(__x) (__x).high
>> +# define u128_low(__x) (__x).low
>> +
>> +# define u128_from_u64(__x) (u128){.low = (__x), .high = 0}
>> +
>> +# define TOPBIT (UINT64_C(1) << 63)
>> +# define MASK32 (UINT64_C(0xffffffff))
>
> Ok.
>
>> +static u128 u128_add (u128 x, u128 y)
>> +{
>> + uint64_t lower = (x.low & ~TOPBIT) + (y.low & ~TOPBIT);
>> + bool carry = (lower >> 63) + (x.low >> 63) + (y.low >> 63) > 1;
>> + return (u128) { .high = x.high + y.high + carry, .low = x.low + y.low };
>> +}
>
> Ok.
>
>> +static u128 u128_lshift (u128 x, unsigned int n)
>> +{
>> + switch (n)
>> + {
>> + case 0: return x;
>> + case 1 ... 63: return (u128) { .high = (x.high << n) | (x.low >> (64 - n)),
>> + .low = x.low << n };
>> + case 64 ...127: return (u128) { .high = x.low << (n - 64), .low = 0};
>> + default: return (u128) { .high = 0, .low = 0 };
>> + }
>> +}
>
> Ok.
>
>> +static u128 u128_rshift (u128 x, unsigned int n)
>> +{
>> + switch (n)
>> + {
>> + case 0: return x;
>> + case 1 ... 63: return (u128) { .high = x.high >> n,
>> + .low = (x.high << (64 - n)) | (x.low >> n) };
>> + case 64 ...127: return (u128) { .high = 0, .low = x.high >> (n - 64) };
>> + default: return (u128) { .high = 0, .low = 0 };
>> + }
>> +}
>
> Ok.
>
>> +static u128 u128_mul (u128 x, u128 y)
>> +{
>> + if (x.high == 0 && y.high == 0)
>> + {
>> + uint64_t x0 = x.low & MASK32;
>> + uint64_t x1 = x.low >> 32;
>> + uint64_t y0 = y.low & MASK32;
>> + uint64_t y1 = y.low >> 32;
>> + u128 x0y0 = { .high = 0, .low = x0 * y0 };
>> + u128 x0y1 = { .high = 0, .low = x0 * y1 };
>> + u128 x1y0 = { .high = 0, .low = x1 * y0 };
>> + u128 x1y1 = { .high = 0, .low = x1 * y1 };
>> + /* x0y0 + ((x0y1 + x1y0) << 32) + (x1y1 << 64) */
>> + return u128_add (u128_add (x0y0, u128_lshift (u128_add (x0y1,
>> + x1y0),
>> + 32)),
>> + u128_lshift (x1y1, 64));
>> + }
>
> Ok.
>
>> + else
>> + {
>> + uint64_t x0 = x.low & MASK32;
>> + uint64_t x1 = x.low >> 32;
>> + uint64_t x2 = x.high & MASK32;
>> + uint64_t x3 = x.high >> 32;
>> + uint64_t y0 = y.low & MASK32;
>> + uint64_t y1 = y.low >> 32;
>> + uint64_t y2 = y.high & MASK32;
>> + uint64_t y3 = y.high >> 32;
>> + u128 x0y0 = { .high = 0, .low = x0 * y0 };
>> + u128 x0y1 = { .high = 0, .low = x0 * y1 };
>> + u128 x0y2 = { .high = 0, .low = x0 * y2 };
>> + u128 x0y3 = { .high = 0, .low = x0 * y3 };
>> + u128 x1y0 = { .high = 0, .low = x1 * y0 };
>> + u128 x1y1 = { .high = 0, .low = x1 * y1 };
>> + u128 x1y2 = { .high = 0, .low = x1 * y2 };
>> + u128 x2y0 = { .high = 0, .low = x2 * y0 };
>> + u128 x2y1 = { .high = 0, .low = x2 * y1 };
>> + u128 x3y0 = { .high = 0, .low = x3 * y0 };
>> + /* x0y0 + ((x0y1 + x1y0) << 32) + ((x0y2 + x1y1 + x2y0) << 64) +
>> + ((x0y3 + x1y2 + x2y1 + x3y0) << 96) */
>> + u128 r0 = u128_add (x0y0,
>> + u128_lshift (u128_add (x0y1, x1y0),
>> + 32));
>> + u128 r1 = u128_add (u128_lshift (u128_add (u128_add (x0y2, x1y1), x2y0),
>> + 64),
>> + u128_lshift (u128_add (u128_add (x0y3, x1y2),
>> + u128_add (x2y1, x3y0)),
>> + 96));
>> + return u128_add (r0, r1);
>> + }
>> +}
>> +#endif /* __SIZEOF_INT128__ */
>> +
>> +#endif
>
> Ok.
>
>> diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
>> diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
>> diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
>
> Ok.
>
>> diff --git a/sysdeps/ieee754/flt-32/k_tanf.c b/sysdeps/ieee754/flt-32/k_tanf.c
>> -/* k_tanf.c -- float version of k_tan.c
>> - */
>> . . .
>> -}
>> +/* Not needed. */
>
> Ok.
>
>> diff --git a/sysdeps/ieee754/flt-32/s_tanf.c b/sysdeps/ieee754/flt-32/s_tanf.c
>> index ae6600bd57..41fd8fe496 100644
>> --- a/sysdeps/ieee754/flt-32/s_tanf.c
>> +++ b/sysdeps/ieee754/flt-32/s_tanf.c
>> @@ -1,76 +1,176 @@
>> -/* s_tanf.c -- float version of s_tan.c.
>> - */
>> +/* Correctly-rounded tangent of binary32 value.
>>
>> -/*
>> - * ====================================================
>> - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
>> - *
>> - * Developed at SunPro, a Sun Microsystems, Inc. business.
>> - * Permission to use, copy, modify, and distribute this
>> - * software is freely granted, provided that this notice
>> - * is preserved.
>> - * ====================================================
>> - */
>> +Copyright (c) 2022-2024 Alexei Sibidanov.
>>
>> -#if defined(LIBM_SCCS) && !defined(lint)
>> -static char rcsid[] = "$NetBSD: s_tanf.c,v 1.4 1995/05/10 20:48:20 jtc Exp $";
>> -#endif
>> +The original version of this file was copied from the CORE-MATH
>> +project (file src/binary32/tan/tanf.c, revision 59d21d7).
>>
>> -#include <errno.h>
>> -#include <math.h>
>> -#include <math_private.h>
>> +Permission is hereby granted, free of charge, to any person obtaining a copy
>> +of this software and associated documentation files (the "Software"), to deal
>> +in the Software without restriction, including without limitation the rights
>> +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
>> +copies of the Software, and to permit persons to whom the Software is
>> +furnished to do so, subject to the following conditions:
>> +
>> +The above copyright notice and this permission notice shall be included in all
>> +copies or substantial portions of the Software.
>> +
>> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
>> +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>> +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
>> +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
>> +SOFTWARE.
>> +*/
>
> Ok.
>
>> +
>> +#include <array_length.h>
>> +#include <stdint.h>
>> #include <libm-alias-float.h>
>> -#include "s_sincosf.h"
>> +#include "math_config.h"
>> +#include <math_int128.h>
>
> Ok.
>
>> -/* Reduce range of X to a multiple of PI/2. The modulo result is between
>> - -PI/4 and PI/4 and returned as a high part y[0] and a low part y[1].
>> - The low bit in the return value indicates the first or 2nd half of tanf. */
>> -static inline int32_t
>> -rem_pio2f (float x, float *y)
>
> Ok.
>
>> +static inline double
>> +rltl (float z, int *q)
>
> Function needs a comment saying what its purpose is? I can't guess from
> "rltl" nor from the contents or usage.
>
>> {
>> - double dx = x;
>> - int n;
>> - const sincos_t *p = &__sincosf_table[0];
>
> Ok.
>
>> + double x = z;
>> + double idl = -0x1.b1bbead603d8bp-32 * x;
>> + double idh = 0x1.45f306ep-1 * x;
>> + double id = roundeven (idh);
>> + *q = (int64_t) id;
>> + return (idh - id) + idl;
>> +}
>
> Ok.
>
>> - if (__glibc_likely (abstop12 (x) < abstop12 (120.0f)))
>> - dx = reduce_fast (dx, p, &n);
>> - else
>
> Ok.
>
>> +static double __attribute__ ((noinline))
>> +rbig (uint32_t u, int *q)
>
> Same here (comment needed). Radians Bigger? Rotate Bigwise? Rhythm
> and Blues Ignores Generations?
Paul has improved the comments on CORE-MATH commit d59182eaf842164626465186427e18d9924ec80b,
and I have added:
+/* argument reduction
+ for |z| < 2^28, return r such that 2/pi*x = q + r */
static inline double
rltl (float z, int *q)
{
@@ -41,6 +43,8 @@ rltl (float z, int *q)
return (idh - id) + idl;
}
+/* argument reduction
+ same as rltl, but for |x| >= 2^28 */
static double __attribute__ ((noinline))
rbig (uint32_t u, int *q)
{
>
>> +{
>> + static const uint64_t ipi[] =
>> {
>> - uint32_t xi = asuint (x);
>> - int sign = xi >> 31;
>> -
>> - dx = reduce_large (xi, &n);
>> - dx = sign ? -dx : dx;
>
> Ok.
>
>> + 0xfe5163abdebbc562, 0xdb6295993c439041,
>> + 0xfc2757d1f534ddc0, 0xa2f9836e4e441529
>> + };
>> + int e = (u >> 23) & 0xff, i;
>> + uint64_t m = (u & (~0u >> 9)) | 1 << 23;
>> + u128 p0 = u128_mul (u128_from_u64 (m), u128_from_u64 (ipi[0]));
>> + u128 p1 = u128_mul (u128_from_u64 (m), u128_from_u64 (ipi[1]));
>> + p1 = u128_add (p1, u128_rshift (p0, 64));
>> + u128 p2 = u128_mul (u128_from_u64 (m), u128_from_u64 (ipi[2]));
>> + p2 = u128_add (p2, u128_rshift (p1, 64));
>> + u128 p3 = u128_mul (u128_from_u64 (m), u128_from_u64 (ipi[3]));
>> + p3 = u128_add (p3, u128_rshift (p2, 64));
>> + uint64_t p3h = u128_high (p3);
>> + uint64_t p3l = u128_low (p3);
>> + uint64_t p2l = u128_low (p2);
>> + uint64_t p1l = u128_low (p1);
>> + int64_t a;
>> + int k = e - 127, s = k - 23;
>
> Ok.
>
>> + /* in ctanf(), rbig() is called in the case 127+28 <= e < 0xff
>> + thus 155 <= e <= 254, which yields 28 <= k <= 127 and 5 <= s <= 104 */
>
> I'm guessing this comment goes with the lines above it, not the
> comparison below? If so, please include a blank line here ;-)
>
>> + if (s < 64)
>> + {
>> + i = p3h << s | p3l >> (64 - s);
>> + a = p3l << s | p2l >> (64 - s);
>> }
>
> Ok.
>
>> -
>> - y[0] = dx;
>> - y[1] = dx - y[0];
>> - return n;
>
> Ok.
>
>> + else if (s == 64)
>> + {
>> + i = p3l;
>> + a = p2l;
>> + }
>> + else
>> + { /* s > 64 */
>> + i = p3l << (s - 64) | p2l >> (128 - s);
>> + a = p2l << (s - 64) | p1l >> (128 - s);
>> + }
>
> Ok.
>
>> + int sgn = u;
>> + sgn >>= 31;
>
> Ok.
>
>> + int64_t sm = a >> 63;
>> + i -= sm;
>> + double z = (a ^ sgn) * 0x1p-64;
>> + i = (i ^ sgn) - sgn;
>> + *q = i;
>> + return z;
>> }
>
> Ok.
>
>> -float __tanf(float x)
>> +float
>> +__tanf (float x)
>> {
>
> Ok.
>
>> - float y[2],z=0.0;
>> - int32_t n, ix;
>> -
>> - GET_FLOAT_WORD(ix,x);
>> -
>> - /* |x| ~< pi/4 */
>> - ix &= 0x7fffffff;
>> - if(ix <= 0x3f490fda) return __kernel_tanf(x,z,1);
>> -
>> - /* tan(Inf or NaN) is NaN */
>> - else if (ix>=0x7f800000) {
>> - if (ix==0x7f800000)
>> - __set_errno (EDOM);
>> - return x-x; /* NaN */
>
> Ok.
>
>> + uint32_t t = asuint (x);
>> + int e = (t >> 23) & 0xff;
>> + int i;
>> + double z;
>> + if (__glibc_likely (e < 127 + 28))
>> + {
>> + if (__glibc_unlikely (e < 115))
>> + {
>> + if (__glibc_unlikely (e < 102))
>> + return fmaf (x, fabsf (x), x);
>> + float x2 = x * x;
>> + return fmaf (x, 0x1.555556p-2f * x2, x);
>> }
>
> Ok.
>
>> -
>> - /* argument reduction needed */
>> - else {
>> - n = rem_pio2f(x,y);
>> - return __kernel_tanf(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even
>> - -1 -- n odd */
>
> Ok.
>
>> + z = rltl (x, &i);
>> + }
>> + else if (e < 0xff)
>> + z = rbig (t, &i);
>> + else
>> + {
>> + if (t << 9)
>> + return x + x; /* nan */
>> + return __math_invalidf (x);
>> + }
>
> Ok.
>
>> + double z2 = z * z;
>> + double z4 = z2 * z2;
>> + static const double cn[] =
>> + {
>> + 0x1.921fb54442d18p+0, -0x1.fd226e573289fp-2,
>> + 0x1.b7a60c8dac9f6p-6, -0x1.725beb40f33e5p-13
>> + };
>> + static const double cd[] =
>> + {
>> + 0x1p+0, -0x1.2395347fb829dp+0,
>> + 0x1.2313660f29c36p-3, -0x1.9a707ab98d1c1p-9
>> + };
>
> Ok.
>
>> + static const double s[] = { 0, 1 };
>> + double n = cn[0] + z2 * cn[1];
>> + double n2 = cn[2] + z2 * cn[3];
>> + n += z4 * n2;
>> + double d = cd[0] + z2 * cd[1];
>> + double d2 = cd[2] + z2 * cd[3];
>> + d += z4 * d2;
>> + n *= z;
>> + double s0 = s[i & 1];
>> + double s1 = s[1 - (i & 1)];
>> + double r1 = (n * s1 - d * s0) / (n * s0 + d * s1);
>
> Ok.
>
>> + uint64_t tail = (asuint64 (r1) + 7) & (~UINT64_C(0) >> 35);
>> + if (__glibc_unlikely (tail <= 14))
>> + {
>> + static const struct
>> + {
>> + float arg;
>> + float rh;
>> + float rl;
>> + } st[] = {
>> + { 0x1.143ec4p+0f, 0x1.ddf9f6p+0f, -0x1.891d24p-52f },
>> + { 0x1.ada6aap+27f, 0x1.e80304p-3f, 0x1.419f46p-58f },
>> + { 0x1.af61dap+48f, 0x1.60d1c8p-2f, -0x1.2d6c3ap-55f },
>> + { 0x1.0088bcp+52f, 0x1.ca1edp+0f, 0x1.f6053p-53f },
>> + { 0x1.f90dfcp+72f, 0x1.597f9cp-1f, 0x1.925978p-53f },
>> + { 0x1.cc4e22p+85f, -0x1.f33584p+1f, 0x1.d7254ap-51f },
>> + { 0x1.a6ce12p+86f, -0x1.c5612ep-1f, -0x1.26c33ep-53f },
>> + { 0x1.6a0b76p+102f, -0x1.e42a1ep+0f, -0x1.1dc906p-52f },
>> + };
>> + uint32_t ax = t & (~0u >> 1);
>> + uint32_t sgn = t >> 31;
>> + for (int j = 0; j < array_length (st); j++)
>> + {
>> + if (__glibc_unlikely (asfloat (st[j].arg) == ax))
>> + {
>> + if (sgn)
>> + return -st[j].rh - st[j].rl;
>> + else
>> + return st[j].rh + st[j].rl;
>> + }
>
> Ok.
>
>> }
>> + }
>> + return r1;
>> }
>> libm_alias_float (__tan, tan)
>
> Ok.
>
>> diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps
>> diff --git a/sysdeps/microblaze/libm-test-ulps b/sysdeps/microblaze/libm-test-ulps
>> diff --git a/sysdeps/mips/mips32/libm-test-ulps b/sysdeps/mips/mips32/libm-test-ulps
>> diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
>> diff --git a/sysdeps/nios2/libm-test-ulps b/sysdeps/nios2/libm-test-ulps
>> diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps
>> diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps
>> diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
>> diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
>> diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps
>> diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps
>> diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
>> diff --git a/sysdeps/sh/libm-test-ulps b/sysdeps/sh/libm-test-ulps
>> diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
>> diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
>
> Ok.
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 07/11] math: Split s_erfF in erff and erfc
2024-11-20 22:40 ` DJ Delorie
@ 2024-11-21 18:28 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 34+ messages in thread
From: Adhemerval Zanella Netto @ 2024-11-21 18:28 UTC (permalink / raw)
To: DJ Delorie; +Cc: libc-alpha
On 20/11/24 19:40, DJ Delorie wrote:
> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
>> So we can eventually replace each implementation.
>
>> diff --git a/math/Makefile b/math/Makefile
>> s_ceilF \
>> s_cosF \
>> s_erfF \
>> + s_erfcF \
>> s_expm1F \
>
> Ok, although 'c' sorts after 'F' in ascii, it sorts before in the
> dictionary. I suspect in this case it's clearer to ignore the F suffix
> as "not part of the name" wrt sorting, so s_erfc after s_erf.
Right, I am relying to lint-makefile test to get this right; but I
am not if this handles it fully correct.
>
>> diff --git a/sysdeps/ieee754/dbl-64/s_erfc.c b/sysdeps/ieee754/dbl-64/s_erfc.c
>> new file mode 100644
>> +/* Not required. */
>
> Ok.
>
>> diff --git a/sysdeps/ieee754/float128/s_erfcf128.c b/sysdeps/ieee754/float128/s_erfcf128.c
>> new file mode 100644
>> +/* Not required. */
>
> Ok.
>
>> diff --git a/sysdeps/ieee754/flt-32/s_erfcf.c b/sysdeps/ieee754/flt-32/s_erfcf.c
>> new file mode 100644
>> index 0000000000..fdba278eff
>> --- /dev/null
>> +++ b/sysdeps/ieee754/flt-32/s_erfcf.c
>> @@ -0,0 +1,173 @@
>> +/* s_erfcf.c -- float version of s_erfc.c.
>> + */
>> . . .
>> +}
>> +libm_alias_float (__erfc, erfc)
>
> Ok. This is just a copy of what's deleted below...
>
>> diff --git a/sysdeps/ieee754/flt-32/s_erff.c b/sysdeps/ieee754/flt-32/s_erff.c
>>
>> static const float
>> tiny = 1e-30,
>> -half= 5.0000000000e-01, /* 0x3F000000 */
>> one = 1.0000000000e+00, /* 0x3F800000 */
>> -two = 2.0000000000e+00, /* 0x40000000 */
>> - /* c = (subfloat)0.84506291151 */
>> erx = 8.4506291151e-01, /* 0x3f58560b */
>> /*
>> * Coefficients for approximation to erf on [0,0.84375]
>> @@ -156,77 +153,3 @@ float __erff(float x)
>> }
>> libm_alias_float (__erf, erf)
>>
>> -float __erfcf(float x)
>> -{
>> . . .
>> -}
>> -libm_alias_float (__erfc, erfc)
>
> Ok.
>
>> diff --git a/sysdeps/ieee754/ldbl-128/s_erfcl.c b/sysdeps/ieee754/ldbl-128/s_erfcl.c
>> new file mode 100644
>> index 0000000000..95d17c8c28
>> --- /dev/null
>> +++ b/sysdeps/ieee754/ldbl-128/s_erfcl.c
>> @@ -0,0 +1 @@
>> +/* Not required. */
>
> Ok
>
>> diff --git a/sysdeps/ieee754/ldbl-128ibm/s_erfcl.c b/sysdeps/ieee754/ldbl-128ibm/s_erfcl.c
>> new file mode 100644
>> index 0000000000..95d17c8c28
>> --- /dev/null
>> +++ b/sysdeps/ieee754/ldbl-128ibm/s_erfcl.c
>> @@ -0,0 +1 @@
>> +/* Not required. */
>
> Ok
>
>> diff --git a/sysdeps/ieee754/ldbl-96/s_erfcl.c b/sysdeps/ieee754/ldbl-96/s_erfcl.c
>> new file mode 100644
>> index 0000000000..95d17c8c28
>> --- /dev/null
>> +++ b/sysdeps/ieee754/ldbl-96/s_erfcl.c
>> @@ -0,0 +1 @@
>> +/* Not required. */
>
> Ok.
>
> LGTM
> Reviewed-by: DJ Delorie <dj@redhat.com>
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 01/11] benchtests: Add cbrtf benchmark
2024-11-21 13:09 ` Adhemerval Zanella Netto
@ 2024-11-21 19:11 ` DJ Delorie
2024-11-22 11:21 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 34+ messages in thread
From: DJ Delorie @ 2024-11-21 19:11 UTC (permalink / raw)
To: Adhemerval Zanella Netto; +Cc: libc-alpha
Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> writes:
>> This is not what's in this file. This is a file of inputs in [1,2]
>
> You are right, I copied from cbrt-inputs without verifying. I have
> change to
I wonder if the original file is wrong too; a domain of [1,8] makes sense
for a cube root benchmark.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 01/11] benchtests: Add cbrtf benchmark
2024-11-21 19:11 ` DJ Delorie
@ 2024-11-22 11:21 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 34+ messages in thread
From: Adhemerval Zanella Netto @ 2024-11-22 11:21 UTC (permalink / raw)
To: DJ Delorie; +Cc: libc-alpha
On 21/11/24 16:11, DJ Delorie wrote:
> Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> writes:
>>> This is not what's in this file. This is a file of inputs in [1,2]
>>
>> You are right, I copied from cbrt-inputs without verifying. I have
>> change to
>
> I wonder if the original file is wrong too; a domain of [1,8] makes sense
> for a cube root benchmark.
>
The original has the domain correct, I will use the domain [1,8] as the
double version.
^ permalink raw reply [flat|nested] 34+ messages in thread
end of thread, other threads:[~2024-11-22 11:21 UTC | newest]
Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-11 13:45 [PATCH 00/11] Add more CORE-math implementations to libm Adhemerval Zanella
2024-11-11 13:45 ` [PATCH 01/11] benchtests: Add cbrtf benchmark Adhemerval Zanella
2024-11-20 21:35 ` DJ Delorie
2024-11-21 13:09 ` Adhemerval Zanella Netto
2024-11-21 19:11 ` DJ Delorie
2024-11-22 11:21 ` Adhemerval Zanella Netto
2024-11-11 13:45 ` [PATCH 02/11] benchtests: Add erff benchmark Adhemerval Zanella
2024-11-20 21:38 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 03/11] benchtests: Add erfcf benchmark Adhemerval Zanella
2024-11-20 21:41 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 04/11] benchtests: Add lgammaf benchmark Adhemerval Zanella
2024-11-20 21:45 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 05/11] benchtests: Add tanf benchmark Adhemerval Zanella
2024-11-20 21:46 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 06/11] math: Use cbrtf from CORE-MATH Adhemerval Zanella
2024-11-20 22:20 ` DJ Delorie
2024-11-21 13:12 ` Adhemerval Zanella Netto
2024-11-11 13:45 ` [PATCH 07/11] math: Split s_erfF in erff and erfc Adhemerval Zanella
2024-11-20 22:40 ` DJ Delorie
2024-11-21 18:28 ` Adhemerval Zanella Netto
2024-11-11 13:45 ` [PATCH 08/11] math: Use erff from CORE-MATH Adhemerval Zanella
2024-11-20 23:10 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 09/11] math: Use erfcf " Adhemerval Zanella
2024-11-21 1:35 ` DJ Delorie
2024-11-21 13:57 ` Adhemerval Zanella Netto
2024-11-11 13:45 ` [PATCH 10/11] math: Use lgammaf " Adhemerval Zanella
2024-11-21 2:38 ` DJ Delorie
2024-11-11 13:45 ` [PATCH 11/11] math: Use tanf " Adhemerval Zanella
2024-11-12 0:23 ` Joseph Myers
2024-11-12 17:42 ` Adhemerval Zanella Netto
2024-11-12 13:17 ` Paul Zimmermann
2024-11-12 18:41 ` Adhemerval Zanella Netto
2024-11-21 3:19 ` DJ Delorie
2024-11-21 14:08 ` Adhemerval Zanella Netto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).