aboutsummaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorPaul Zimmermann <Paul.Zimmermann@inria.fr>2021-04-02 08:21:06 +0200
committerPaul Zimmermann <Paul.Zimmermann@inria.fr>2021-04-07 13:23:39 +0200
commit43576de04afc6a0896a3ecc094e1581069a0652a (patch)
tree42b35efc19ae2a9f22c354176d83173f74818268 /math
parentd1a3dcabf2f89233a99a4a9be08f9f407da0b6b4 (diff)
downloadglibc-43576de04afc6a0896a3ecc094e1581069a0652a.zip
glibc-43576de04afc6a0896a3ecc094e1581069a0652a.tar.gz
glibc-43576de04afc6a0896a3ecc094e1581069a0652a.tar.bz2
Improve the accuracy of tgamma (BZ #26983)
With this patch, the maximal known error for tgamma is now reduced to 9 ulps for dbl-64, for all rounding modes. Since exhaustive testing is not possible for dbl-64, it might be that there are still cases with an error larger than 9 ulps, but all known cases are fixed (intensive tests were done to find cases with large errors). Tested on x86_64 and powerpc (and by Adhemerval Zanella on aarch64, arm, s390x, sparc, and i686). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'math')
-rw-r--r--math/auto-libm-test-in6
-rw-r--r--math/auto-libm-test-out-tgamma276
-rw-r--r--math/mul_split.h65
3 files changed, 346 insertions, 1 deletions
diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 9fbd0c6..2045a0f 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -8251,8 +8251,12 @@ tgamma -0x6.ce9158p+0
tgamma -0xd.cbf53d0e7d06p+0
# the next value generates larger error bounds on x86_64 (binary32)
tgamma -0x3.0aa534p+0
-# the next value generates larger error bounds on x86_64 (binary64)
+# the next values generate large error bounds on x86_64 (binary64)
tgamma -0x1.62b8c36c7180bp+4
+tgamma -0x1.62c4d519e8677p+3
+tgamma -0x1.c033cc426752fp+2
+tgamma -0x1.62cfd0d34ade2p+3
+tgamma -0x1.8814da6eb7dbp+5
y0 0.125
y0 0.75
diff --git a/math/auto-libm-test-out-tgamma b/math/auto-libm-test-out-tgamma
index 032ad3a..20a9916 100644
--- a/math/auto-libm-test-out-tgamma
+++ b/math/auto-libm-test-out-tgamma
@@ -27397,3 +27397,279 @@ tgamma -0x1.62b8c36c7180bp+4
= tgamma tonearest ibm128 -0x1.62b8c36c7180bp+4 : -0xf.3fb73d327d6a801abb3039b104p-72 : inexact-ok
= tgamma towardzero ibm128 -0x1.62b8c36c7180bp+4 : -0xf.3fb73d327d6a801abb3039b1p-72 : inexact-ok
= tgamma upward ibm128 -0x1.62b8c36c7180bp+4 : -0xf.3fb73d327d6a801abb3039b1p-72 : inexact-ok
+tgamma -0x1.62c4d519e8677p+3
+= tgamma downward binary32 -0xb.1626ap+0 : 0x3.fac968p-24 : inexact-ok
+= tgamma tonearest binary32 -0xb.1626ap+0 : 0x3.fac96cp-24 : inexact-ok
+= tgamma towardzero binary32 -0xb.1626ap+0 : 0x3.fac968p-24 : inexact-ok
+= tgamma upward binary32 -0xb.1626ap+0 : 0x3.fac96cp-24 : inexact-ok
+= tgamma downward binary64 -0xb.1626ap+0 : 0x3.fac96a100e60ep-24 : inexact-ok
+= tgamma tonearest binary64 -0xb.1626ap+0 : 0x3.fac96a100e61p-24 : inexact-ok
+= tgamma towardzero binary64 -0xb.1626ap+0 : 0x3.fac96a100e60ep-24 : inexact-ok
+= tgamma upward binary64 -0xb.1626ap+0 : 0x3.fac96a100e61p-24 : inexact-ok
+= tgamma downward intel96 -0xb.1626ap+0 : 0x3.fac96a100e60f1f8p-24 : inexact-ok
+= tgamma tonearest intel96 -0xb.1626ap+0 : 0x3.fac96a100e60f1fcp-24 : inexact-ok
+= tgamma towardzero intel96 -0xb.1626ap+0 : 0x3.fac96a100e60f1f8p-24 : inexact-ok
+= tgamma upward intel96 -0xb.1626ap+0 : 0x3.fac96a100e60f1fcp-24 : inexact-ok
+= tgamma downward m68k96 -0xb.1626ap+0 : 0x3.fac96a100e60f1f8p-24 : inexact-ok
+= tgamma tonearest m68k96 -0xb.1626ap+0 : 0x3.fac96a100e60f1fcp-24 : inexact-ok
+= tgamma towardzero m68k96 -0xb.1626ap+0 : 0x3.fac96a100e60f1f8p-24 : inexact-ok
+= tgamma upward m68k96 -0xb.1626ap+0 : 0x3.fac96a100e60f1fcp-24 : inexact-ok
+= tgamma downward binary128 -0xb.1626ap+0 : 0x3.fac96a100e60f1fa454b8cdcdfb6p-24 : inexact-ok
+= tgamma tonearest binary128 -0xb.1626ap+0 : 0x3.fac96a100e60f1fa454b8cdcdfb8p-24 : inexact-ok
+= tgamma towardzero binary128 -0xb.1626ap+0 : 0x3.fac96a100e60f1fa454b8cdcdfb6p-24 : inexact-ok
+= tgamma upward binary128 -0xb.1626ap+0 : 0x3.fac96a100e60f1fa454b8cdcdfb8p-24 : inexact-ok
+= tgamma downward ibm128 -0xb.1626ap+0 : 0x3.fac96a100e60f1fa454b8cdcdfp-24 : inexact-ok
+= tgamma tonearest ibm128 -0xb.1626ap+0 : 0x3.fac96a100e60f1fa454b8cdcep-24 : inexact-ok
+= tgamma towardzero ibm128 -0xb.1626ap+0 : 0x3.fac96a100e60f1fa454b8cdcdfp-24 : inexact-ok
+= tgamma upward ibm128 -0xb.1626ap+0 : 0x3.fac96a100e60f1fa454b8cdcep-24 : inexact-ok
+= tgamma downward binary32 -0xb.1626bp+0 : 0x3.fac6p-24 : inexact-ok
+= tgamma tonearest binary32 -0xb.1626bp+0 : 0x3.fac6p-24 : inexact-ok
+= tgamma towardzero binary32 -0xb.1626bp+0 : 0x3.fac6p-24 : inexact-ok
+= tgamma upward binary32 -0xb.1626bp+0 : 0x3.fac604p-24 : inexact-ok
+= tgamma downward binary64 -0xb.1626bp+0 : 0x3.fac600633d74p-24 : inexact-ok
+= tgamma tonearest binary64 -0xb.1626bp+0 : 0x3.fac600633d742p-24 : inexact-ok
+= tgamma towardzero binary64 -0xb.1626bp+0 : 0x3.fac600633d74p-24 : inexact-ok
+= tgamma upward binary64 -0xb.1626bp+0 : 0x3.fac600633d742p-24 : inexact-ok
+= tgamma downward intel96 -0xb.1626bp+0 : 0x3.fac600633d7414fp-24 : inexact-ok
+= tgamma tonearest intel96 -0xb.1626bp+0 : 0x3.fac600633d7414f4p-24 : inexact-ok
+= tgamma towardzero intel96 -0xb.1626bp+0 : 0x3.fac600633d7414fp-24 : inexact-ok
+= tgamma upward intel96 -0xb.1626bp+0 : 0x3.fac600633d7414f4p-24 : inexact-ok
+= tgamma downward m68k96 -0xb.1626bp+0 : 0x3.fac600633d7414fp-24 : inexact-ok
+= tgamma tonearest m68k96 -0xb.1626bp+0 : 0x3.fac600633d7414f4p-24 : inexact-ok
+= tgamma towardzero m68k96 -0xb.1626bp+0 : 0x3.fac600633d7414fp-24 : inexact-ok
+= tgamma upward m68k96 -0xb.1626bp+0 : 0x3.fac600633d7414f4p-24 : inexact-ok
+= tgamma downward binary128 -0xb.1626bp+0 : 0x3.fac600633d7414f378d97364607cp-24 : inexact-ok
+= tgamma tonearest binary128 -0xb.1626bp+0 : 0x3.fac600633d7414f378d97364607cp-24 : inexact-ok
+= tgamma towardzero binary128 -0xb.1626bp+0 : 0x3.fac600633d7414f378d97364607cp-24 : inexact-ok
+= tgamma upward binary128 -0xb.1626bp+0 : 0x3.fac600633d7414f378d97364607ep-24 : inexact-ok
+= tgamma downward ibm128 -0xb.1626bp+0 : 0x3.fac600633d7414f378d973646p-24 : inexact-ok
+= tgamma tonearest ibm128 -0xb.1626bp+0 : 0x3.fac600633d7414f378d973646p-24 : inexact-ok
+= tgamma towardzero ibm128 -0xb.1626bp+0 : 0x3.fac600633d7414f378d973646p-24 : inexact-ok
+= tgamma upward ibm128 -0xb.1626bp+0 : 0x3.fac600633d7414f378d9736461p-24 : inexact-ok
+= tgamma downward binary64 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7ep-24 : inexact-ok
+= tgamma tonearest binary64 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7ep-24 : inexact-ok
+= tgamma towardzero binary64 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7ep-24 : inexact-ok
+= tgamma upward binary64 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d8p-24 : inexact-ok
+= tgamma downward intel96 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e69p-24 : inexact-ok
+= tgamma tonearest intel96 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e694p-24 : inexact-ok
+= tgamma towardzero intel96 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e69p-24 : inexact-ok
+= tgamma upward intel96 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e694p-24 : inexact-ok
+= tgamma downward m68k96 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e69p-24 : inexact-ok
+= tgamma tonearest m68k96 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e694p-24 : inexact-ok
+= tgamma towardzero m68k96 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e69p-24 : inexact-ok
+= tgamma upward m68k96 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e694p-24 : inexact-ok
+= tgamma downward binary128 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e693c33b139429ecp-24 : inexact-ok
+= tgamma tonearest binary128 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e693c33b139429ecp-24 : inexact-ok
+= tgamma towardzero binary128 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e693c33b139429ecp-24 : inexact-ok
+= tgamma upward binary128 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e693c33b139429eep-24 : inexact-ok
+= tgamma downward ibm128 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e693c33b139429p-24 : inexact-ok
+= tgamma tonearest ibm128 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e693c33b13942ap-24 : inexact-ok
+= tgamma towardzero ibm128 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e693c33b139429p-24 : inexact-ok
+= tgamma upward ibm128 -0xb.1626a8cf433b8p+0 : 0x3.fac7890382d7e693c33b13942ap-24 : inexact-ok
+tgamma -0x1.c033cc426752fp+2
+= tgamma downward binary32 -0x7.00cf3p+0 : 0xf.f7014p-8 : inexact-ok
+= tgamma tonearest binary32 -0x7.00cf3p+0 : 0xf.f7014p-8 : inexact-ok
+= tgamma towardzero binary32 -0x7.00cf3p+0 : 0xf.f7014p-8 : inexact-ok
+= tgamma upward binary32 -0x7.00cf3p+0 : 0xf.f7015p-8 : inexact-ok
+= tgamma downward binary64 -0x7.00cf3p+0 : 0xf.f7014642d9848p-8 : inexact-ok
+= tgamma tonearest binary64 -0x7.00cf3p+0 : 0xf.f7014642d9848p-8 : inexact-ok
+= tgamma towardzero binary64 -0x7.00cf3p+0 : 0xf.f7014642d9848p-8 : inexact-ok
+= tgamma upward binary64 -0x7.00cf3p+0 : 0xf.f7014642d985p-8 : inexact-ok
+= tgamma downward intel96 -0x7.00cf3p+0 : 0xf.f7014642d9849fcp-8 : inexact-ok
+= tgamma tonearest intel96 -0x7.00cf3p+0 : 0xf.f7014642d9849fcp-8 : inexact-ok
+= tgamma towardzero intel96 -0x7.00cf3p+0 : 0xf.f7014642d9849fcp-8 : inexact-ok
+= tgamma upward intel96 -0x7.00cf3p+0 : 0xf.f7014642d9849fdp-8 : inexact-ok
+= tgamma downward m68k96 -0x7.00cf3p+0 : 0xf.f7014642d9849fcp-8 : inexact-ok
+= tgamma tonearest m68k96 -0x7.00cf3p+0 : 0xf.f7014642d9849fcp-8 : inexact-ok
+= tgamma towardzero m68k96 -0x7.00cf3p+0 : 0xf.f7014642d9849fcp-8 : inexact-ok
+= tgamma upward m68k96 -0x7.00cf3p+0 : 0xf.f7014642d9849fdp-8 : inexact-ok
+= tgamma downward binary128 -0x7.00cf3p+0 : 0xf.f7014642d9849fc3f8a3bdea2ae8p-8 : inexact-ok
+= tgamma tonearest binary128 -0x7.00cf3p+0 : 0xf.f7014642d9849fc3f8a3bdea2afp-8 : inexact-ok
+= tgamma towardzero binary128 -0x7.00cf3p+0 : 0xf.f7014642d9849fc3f8a3bdea2ae8p-8 : inexact-ok
+= tgamma upward binary128 -0x7.00cf3p+0 : 0xf.f7014642d9849fc3f8a3bdea2afp-8 : inexact-ok
+= tgamma downward ibm128 -0x7.00cf3p+0 : 0xf.f7014642d9849fc3f8a3bdea28p-8 : inexact-ok
+= tgamma tonearest ibm128 -0x7.00cf3p+0 : 0xf.f7014642d9849fc3f8a3bdea2cp-8 : inexact-ok
+= tgamma towardzero ibm128 -0x7.00cf3p+0 : 0xf.f7014642d9849fc3f8a3bdea28p-8 : inexact-ok
+= tgamma upward ibm128 -0x7.00cf3p+0 : 0xf.f7014642d9849fc3f8a3bdea2cp-8 : inexact-ok
+= tgamma downward binary32 -0x7.00cf38p+0 : 0xf.f6627p-8 : inexact-ok
+= tgamma tonearest binary32 -0x7.00cf38p+0 : 0xf.f6628p-8 : inexact-ok
+= tgamma towardzero binary32 -0x7.00cf38p+0 : 0xf.f6627p-8 : inexact-ok
+= tgamma upward binary32 -0x7.00cf38p+0 : 0xf.f6628p-8 : inexact-ok
+= tgamma downward binary64 -0x7.00cf38p+0 : 0xf.f6627d248f8ep-8 : inexact-ok
+= tgamma tonearest binary64 -0x7.00cf38p+0 : 0xf.f6627d248f8ep-8 : inexact-ok
+= tgamma towardzero binary64 -0x7.00cf38p+0 : 0xf.f6627d248f8ep-8 : inexact-ok
+= tgamma upward binary64 -0x7.00cf38p+0 : 0xf.f6627d248f8e8p-8 : inexact-ok
+= tgamma downward intel96 -0x7.00cf38p+0 : 0xf.f6627d248f8e25dp-8 : inexact-ok
+= tgamma tonearest intel96 -0x7.00cf38p+0 : 0xf.f6627d248f8e25ep-8 : inexact-ok
+= tgamma towardzero intel96 -0x7.00cf38p+0 : 0xf.f6627d248f8e25dp-8 : inexact-ok
+= tgamma upward intel96 -0x7.00cf38p+0 : 0xf.f6627d248f8e25ep-8 : inexact-ok
+= tgamma downward m68k96 -0x7.00cf38p+0 : 0xf.f6627d248f8e25dp-8 : inexact-ok
+= tgamma tonearest m68k96 -0x7.00cf38p+0 : 0xf.f6627d248f8e25ep-8 : inexact-ok
+= tgamma towardzero m68k96 -0x7.00cf38p+0 : 0xf.f6627d248f8e25dp-8 : inexact-ok
+= tgamma upward m68k96 -0x7.00cf38p+0 : 0xf.f6627d248f8e25ep-8 : inexact-ok
+= tgamma downward binary128 -0x7.00cf38p+0 : 0xf.f6627d248f8e25ddceb81585fcbp-8 : inexact-ok
+= tgamma tonearest binary128 -0x7.00cf38p+0 : 0xf.f6627d248f8e25ddceb81585fcb8p-8 : inexact-ok
+= tgamma towardzero binary128 -0x7.00cf38p+0 : 0xf.f6627d248f8e25ddceb81585fcbp-8 : inexact-ok
+= tgamma upward binary128 -0x7.00cf38p+0 : 0xf.f6627d248f8e25ddceb81585fcb8p-8 : inexact-ok
+= tgamma downward ibm128 -0x7.00cf38p+0 : 0xf.f6627d248f8e25ddceb81585fcp-8 : inexact-ok
+= tgamma tonearest ibm128 -0x7.00cf38p+0 : 0xf.f6627d248f8e25ddceb81585fcp-8 : inexact-ok
+= tgamma towardzero ibm128 -0x7.00cf38p+0 : 0xf.f6627d248f8e25ddceb81585fcp-8 : inexact-ok
+= tgamma upward ibm128 -0x7.00cf38p+0 : 0xf.f6627d248f8e25ddceb81586p-8 : inexact-ok
+= tgamma downward binary64 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad9999808p-8 : inexact-ok
+= tgamma tonearest binary64 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999981p-8 : inexact-ok
+= tgamma towardzero binary64 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad9999808p-8 : inexact-ok
+= tgamma upward binary64 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999981p-8 : inexact-ok
+= tgamma downward intel96 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4ap-8 : inexact-ok
+= tgamma tonearest intel96 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4ap-8 : inexact-ok
+= tgamma towardzero intel96 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4ap-8 : inexact-ok
+= tgamma upward intel96 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4bp-8 : inexact-ok
+= tgamma downward m68k96 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4ap-8 : inexact-ok
+= tgamma tonearest m68k96 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4ap-8 : inexact-ok
+= tgamma towardzero m68k96 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4ap-8 : inexact-ok
+= tgamma upward m68k96 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4bp-8 : inexact-ok
+= tgamma downward binary128 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4a4868608814ecp-8 : inexact-ok
+= tgamma tonearest binary128 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4a4868608814ecp-8 : inexact-ok
+= tgamma towardzero binary128 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4a4868608814ecp-8 : inexact-ok
+= tgamma upward binary128 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4a4868608814ec8p-8 : inexact-ok
+= tgamma downward ibm128 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4a4868608814cp-8 : inexact-ok
+= tgamma tonearest ibm128 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4a4868608815p-8 : inexact-ok
+= tgamma towardzero ibm128 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4a4868608814cp-8 : inexact-ok
+= tgamma upward ibm128 -0x7.00cf31099d4bcp+0 : 0xf.f6ecad999980e4a4868608815p-8 : inexact-ok
+tgamma -0x1.62cfd0d34ade2p+3
+= tgamma downward binary32 -0xb.167e8p+0 : 0x3.e85604p-24 : inexact-ok
+= tgamma tonearest binary32 -0xb.167e8p+0 : 0x3.e85608p-24 : inexact-ok
+= tgamma towardzero binary32 -0xb.167e8p+0 : 0x3.e85604p-24 : inexact-ok
+= tgamma upward binary32 -0xb.167e8p+0 : 0x3.e85608p-24 : inexact-ok
+= tgamma downward binary64 -0xb.167e8p+0 : 0x3.e85606c693e9ap-24 : inexact-ok
+= tgamma tonearest binary64 -0xb.167e8p+0 : 0x3.e85606c693e9cp-24 : inexact-ok
+= tgamma towardzero binary64 -0xb.167e8p+0 : 0x3.e85606c693e9ap-24 : inexact-ok
+= tgamma upward binary64 -0xb.167e8p+0 : 0x3.e85606c693e9cp-24 : inexact-ok
+= tgamma downward intel96 -0xb.167e8p+0 : 0x3.e85606c693e9bf24p-24 : inexact-ok
+= tgamma tonearest intel96 -0xb.167e8p+0 : 0x3.e85606c693e9bf24p-24 : inexact-ok
+= tgamma towardzero intel96 -0xb.167e8p+0 : 0x3.e85606c693e9bf24p-24 : inexact-ok
+= tgamma upward intel96 -0xb.167e8p+0 : 0x3.e85606c693e9bf28p-24 : inexact-ok
+= tgamma downward m68k96 -0xb.167e8p+0 : 0x3.e85606c693e9bf24p-24 : inexact-ok
+= tgamma tonearest m68k96 -0xb.167e8p+0 : 0x3.e85606c693e9bf24p-24 : inexact-ok
+= tgamma towardzero m68k96 -0xb.167e8p+0 : 0x3.e85606c693e9bf24p-24 : inexact-ok
+= tgamma upward m68k96 -0xb.167e8p+0 : 0x3.e85606c693e9bf28p-24 : inexact-ok
+= tgamma downward binary128 -0xb.167e8p+0 : 0x3.e85606c693e9bf25ff07132c8c3ap-24 : inexact-ok
+= tgamma tonearest binary128 -0xb.167e8p+0 : 0x3.e85606c693e9bf25ff07132c8c3cp-24 : inexact-ok
+= tgamma towardzero binary128 -0xb.167e8p+0 : 0x3.e85606c693e9bf25ff07132c8c3ap-24 : inexact-ok
+= tgamma upward binary128 -0xb.167e8p+0 : 0x3.e85606c693e9bf25ff07132c8c3cp-24 : inexact-ok
+= tgamma downward ibm128 -0xb.167e8p+0 : 0x3.e85606c693e9bf25ff07132c8cp-24 : inexact-ok
+= tgamma tonearest ibm128 -0xb.167e8p+0 : 0x3.e85606c693e9bf25ff07132c8cp-24 : inexact-ok
+= tgamma towardzero ibm128 -0xb.167e8p+0 : 0x3.e85606c693e9bf25ff07132c8cp-24 : inexact-ok
+= tgamma upward ibm128 -0xb.167e8p+0 : 0x3.e85606c693e9bf25ff07132c8dp-24 : inexact-ok
+= tgamma downward binary32 -0xb.167e9p+0 : 0x3.e852b8p-24 : inexact-ok
+= tgamma tonearest binary32 -0xb.167e9p+0 : 0x3.e852b8p-24 : inexact-ok
+= tgamma towardzero binary32 -0xb.167e9p+0 : 0x3.e852b8p-24 : inexact-ok
+= tgamma upward binary32 -0xb.167e9p+0 : 0x3.e852bcp-24 : inexact-ok
+= tgamma downward binary64 -0xb.167e9p+0 : 0x3.e852b838ddf22p-24 : inexact-ok
+= tgamma tonearest binary64 -0xb.167e9p+0 : 0x3.e852b838ddf24p-24 : inexact-ok
+= tgamma towardzero binary64 -0xb.167e9p+0 : 0x3.e852b838ddf22p-24 : inexact-ok
+= tgamma upward binary64 -0xb.167e9p+0 : 0x3.e852b838ddf24p-24 : inexact-ok
+= tgamma downward intel96 -0xb.167e9p+0 : 0x3.e852b838ddf2348cp-24 : inexact-ok
+= tgamma tonearest intel96 -0xb.167e9p+0 : 0x3.e852b838ddf2349p-24 : inexact-ok
+= tgamma towardzero intel96 -0xb.167e9p+0 : 0x3.e852b838ddf2348cp-24 : inexact-ok
+= tgamma upward intel96 -0xb.167e9p+0 : 0x3.e852b838ddf2349p-24 : inexact-ok
+= tgamma downward m68k96 -0xb.167e9p+0 : 0x3.e852b838ddf2348cp-24 : inexact-ok
+= tgamma tonearest m68k96 -0xb.167e9p+0 : 0x3.e852b838ddf2349p-24 : inexact-ok
+= tgamma towardzero m68k96 -0xb.167e9p+0 : 0x3.e852b838ddf2348cp-24 : inexact-ok
+= tgamma upward m68k96 -0xb.167e9p+0 : 0x3.e852b838ddf2349p-24 : inexact-ok
+= tgamma downward binary128 -0xb.167e9p+0 : 0x3.e852b838ddf2348f185dd745531ep-24 : inexact-ok
+= tgamma tonearest binary128 -0xb.167e9p+0 : 0x3.e852b838ddf2348f185dd745531ep-24 : inexact-ok
+= tgamma towardzero binary128 -0xb.167e9p+0 : 0x3.e852b838ddf2348f185dd745531ep-24 : inexact-ok
+= tgamma upward binary128 -0xb.167e9p+0 : 0x3.e852b838ddf2348f185dd745532p-24 : inexact-ok
+= tgamma downward ibm128 -0xb.167e9p+0 : 0x3.e852b838ddf2348f185dd74553p-24 : inexact-ok
+= tgamma tonearest ibm128 -0xb.167e9p+0 : 0x3.e852b838ddf2348f185dd74553p-24 : inexact-ok
+= tgamma towardzero ibm128 -0xb.167e9p+0 : 0x3.e852b838ddf2348f185dd74553p-24 : inexact-ok
+= tgamma upward ibm128 -0xb.167e9p+0 : 0x3.e852b838ddf2348f185dd74554p-24 : inexact-ok
+= tgamma downward binary64 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa6p-24 : inexact-ok
+= tgamma tonearest binary64 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa8p-24 : inexact-ok
+= tgamma towardzero binary64 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa6p-24 : inexact-ok
+= tgamma upward binary64 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa8p-24 : inexact-ok
+= tgamma downward intel96 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e84p-24 : inexact-ok
+= tgamma tonearest intel96 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e84p-24 : inexact-ok
+= tgamma towardzero intel96 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e84p-24 : inexact-ok
+= tgamma upward intel96 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e88p-24 : inexact-ok
+= tgamma downward m68k96 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e84p-24 : inexact-ok
+= tgamma tonearest m68k96 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e84p-24 : inexact-ok
+= tgamma towardzero m68k96 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e84p-24 : inexact-ok
+= tgamma upward m68k96 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e88p-24 : inexact-ok
+= tgamma downward binary128 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e84ba5e7829836ap-24 : inexact-ok
+= tgamma tonearest binary128 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e84ba5e7829836ap-24 : inexact-ok
+= tgamma towardzero binary128 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e84ba5e7829836ap-24 : inexact-ok
+= tgamma upward binary128 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e84ba5e7829836cp-24 : inexact-ok
+= tgamma downward ibm128 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e84ba5e782983p-24 : inexact-ok
+= tgamma tonearest ibm128 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e84ba5e782983p-24 : inexact-ok
+= tgamma towardzero ibm128 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e84ba5e782983p-24 : inexact-ok
+= tgamma upward ibm128 -0xb.167e869a56f1p+0 : 0x3.e854a96acdfa7e84ba5e782984p-24 : inexact-ok
+tgamma -0x1.8814da6eb7dbp+5
+= tgamma downward binary32 -0x3.1029b4p+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= tgamma tonearest binary32 -0x3.1029b4p+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= tgamma towardzero binary32 -0x3.1029b4p+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= tgamma upward binary32 -0x3.1029b4p+4 : 0x8p-152 : inexact-ok underflow errno-erange-ok
+= tgamma downward binary64 -0x3.1029b4p+4 : 0x3.fd9063a22653ep-204 : inexact-ok
+= tgamma tonearest binary64 -0x3.1029b4p+4 : 0x3.fd9063a22653ep-204 : inexact-ok
+= tgamma towardzero binary64 -0x3.1029b4p+4 : 0x3.fd9063a22653ep-204 : inexact-ok
+= tgamma upward binary64 -0x3.1029b4p+4 : 0x3.fd9063a22654p-204 : inexact-ok
+= tgamma downward intel96 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e4p-204 : inexact-ok
+= tgamma tonearest intel96 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e4p-204 : inexact-ok
+= tgamma towardzero intel96 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e4p-204 : inexact-ok
+= tgamma upward intel96 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e8p-204 : inexact-ok
+= tgamma downward m68k96 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e4p-204 : inexact-ok
+= tgamma tonearest m68k96 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e4p-204 : inexact-ok
+= tgamma towardzero m68k96 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e4p-204 : inexact-ok
+= tgamma upward m68k96 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e8p-204 : inexact-ok
+= tgamma downward binary128 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e5a73bb2d5a5bcp-204 : inexact-ok
+= tgamma tonearest binary128 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e5a73bb2d5a5bcp-204 : inexact-ok
+= tgamma towardzero binary128 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e5a73bb2d5a5bcp-204 : inexact-ok
+= tgamma upward binary128 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e5a73bb2d5a5bep-204 : inexact-ok
+= tgamma downward ibm128 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e5a73bb2d5a5p-204 : inexact-ok
+= tgamma tonearest ibm128 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e5a73bb2d5a6p-204 : inexact-ok
+= tgamma towardzero ibm128 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e5a73bb2d5a5p-204 : inexact-ok
+= tgamma upward ibm128 -0x3.1029b4p+4 : 0x3.fd9063a22653e8e5a73bb2d5a6p-204 : inexact-ok
+= tgamma downward binary32 -0x3.1029b8p+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= tgamma tonearest binary32 -0x3.1029b8p+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= tgamma towardzero binary32 -0x3.1029b8p+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= tgamma upward binary32 -0x3.1029b8p+4 : 0x8p-152 : inexact-ok underflow errno-erange-ok
+= tgamma downward binary64 -0x3.1029b8p+4 : 0x3.fd2a955e20f56p-204 : inexact-ok
+= tgamma tonearest binary64 -0x3.1029b8p+4 : 0x3.fd2a955e20f58p-204 : inexact-ok
+= tgamma towardzero binary64 -0x3.1029b8p+4 : 0x3.fd2a955e20f56p-204 : inexact-ok
+= tgamma upward binary64 -0x3.1029b8p+4 : 0x3.fd2a955e20f58p-204 : inexact-ok
+= tgamma downward intel96 -0x3.1029b8p+4 : 0x3.fd2a955e20f57628p-204 : inexact-ok
+= tgamma tonearest intel96 -0x3.1029b8p+4 : 0x3.fd2a955e20f5762cp-204 : inexact-ok
+= tgamma towardzero intel96 -0x3.1029b8p+4 : 0x3.fd2a955e20f57628p-204 : inexact-ok
+= tgamma upward intel96 -0x3.1029b8p+4 : 0x3.fd2a955e20f5762cp-204 : inexact-ok
+= tgamma downward m68k96 -0x3.1029b8p+4 : 0x3.fd2a955e20f57628p-204 : inexact-ok
+= tgamma tonearest m68k96 -0x3.1029b8p+4 : 0x3.fd2a955e20f5762cp-204 : inexact-ok
+= tgamma towardzero m68k96 -0x3.1029b8p+4 : 0x3.fd2a955e20f57628p-204 : inexact-ok
+= tgamma upward m68k96 -0x3.1029b8p+4 : 0x3.fd2a955e20f5762cp-204 : inexact-ok
+= tgamma downward binary128 -0x3.1029b8p+4 : 0x3.fd2a955e20f5762a464af7f01716p-204 : inexact-ok
+= tgamma tonearest binary128 -0x3.1029b8p+4 : 0x3.fd2a955e20f5762a464af7f01718p-204 : inexact-ok
+= tgamma towardzero binary128 -0x3.1029b8p+4 : 0x3.fd2a955e20f5762a464af7f01716p-204 : inexact-ok
+= tgamma upward binary128 -0x3.1029b8p+4 : 0x3.fd2a955e20f5762a464af7f01718p-204 : inexact-ok
+= tgamma downward ibm128 -0x3.1029b8p+4 : 0x3.fd2a955e20f5762a464af7f017p-204 : inexact-ok
+= tgamma tonearest ibm128 -0x3.1029b8p+4 : 0x3.fd2a955e20f5762a464af7f017p-204 : inexact-ok
+= tgamma towardzero ibm128 -0x3.1029b8p+4 : 0x3.fd2a955e20f5762a464af7f017p-204 : inexact-ok
+= tgamma upward ibm128 -0x3.1029b8p+4 : 0x3.fd2a955e20f5762a464af7f018p-204 : inexact-ok
+= tgamma downward binary64 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5cp-204 : inexact-ok
+= tgamma tonearest binary64 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5cp-204 : inexact-ok
+= tgamma towardzero binary64 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5cp-204 : inexact-ok
+= tgamma upward binary64 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5ep-204 : inexact-ok
+= tgamma downward intel96 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d4p-204 : inexact-ok
+= tgamma tonearest intel96 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d8p-204 : inexact-ok
+= tgamma towardzero intel96 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d4p-204 : inexact-ok
+= tgamma upward intel96 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d8p-204 : inexact-ok
+= tgamma downward m68k96 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d4p-204 : inexact-ok
+= tgamma tonearest m68k96 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d8p-204 : inexact-ok
+= tgamma towardzero m68k96 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d4p-204 : inexact-ok
+= tgamma upward m68k96 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d8p-204 : inexact-ok
+= tgamma downward binary128 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d62103dbf6d82ep-204 : inexact-ok
+= tgamma tonearest binary128 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d62103dbf6d82ep-204 : inexact-ok
+= tgamma towardzero binary128 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d62103dbf6d82ep-204 : inexact-ok
+= tgamma upward binary128 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d62103dbf6d83p-204 : inexact-ok
+= tgamma downward ibm128 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d62103dbf6d8p-204 : inexact-ok
+= tgamma tonearest ibm128 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d62103dbf6d8p-204 : inexact-ok
+= tgamma towardzero ibm128 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d62103dbf6d8p-204 : inexact-ok
+= tgamma upward ibm128 -0x3.1029b4dd6fb6p+4 : 0x3.fd7a5e1abda5c6d62103dbf6d9p-204 : inexact-ok
diff --git a/math/mul_split.h b/math/mul_split.h
index 8cc60ec..af614fb 100644
--- a/math/mul_split.h
+++ b/math/mul_split.h
@@ -47,4 +47,69 @@ mul_split (double *hi, double *lo, double x, double y)
#endif
}
+/* Add a + b exactly, such that *hi + *lo = a + b.
+ Assumes |a| >= |b| and rounding to nearest. */
+static inline void
+fast_two_sum (double *hi, double *lo, double a, double b)
+{
+ double e;
+
+ *hi = a + b;
+ e = *hi - a; /* exact */
+ *lo = b - e; /* exact */
+ /* Now *hi + *lo = a + b exactly. */
+}
+
+/* Multiplication of two floating-point expansions: *hi + *lo is an
+ approximation of (h1+l1)*(h2+l2), assuming |l1| <= 1/2*ulp(h1)
+ and |l2| <= 1/2*ulp(h2) and rounding to nearest. */
+static inline void
+mul_expansion (double *hi, double *lo, double h1, double l1,
+ double h2, double l2)
+{
+ double r, e;
+
+ mul_split (hi, lo, h1, h2);
+ r = h1 * l2 + h2 * l1;
+ /* Now add r to (hi,lo) using fast two-sum, where we know |r| < |hi|. */
+ fast_two_sum (hi, &e, *hi, r);
+ *lo -= e;
+}
+
+/* Calculate X / Y and store the approximate result in *HI + *LO. It is
+ assumed that Y is not zero, that no overflow nor underflow occurs, and
+ rounding is to nearest. */
+static inline void
+div_split (double *hi, double *lo, double x, double y)
+{
+ double a, b;
+
+ *hi = x / y;
+ mul_split (&a, &b, *hi, y);
+ /* a + b = hi*y, which should be near x. */
+ a = x - a; /* huge cancellation */
+ a = a - b;
+ /* Now x ~ hi*y + a thus x/y ~ hi + a/y. */
+ *lo = a / y;
+}
+
+/* Division of two floating-point expansions: *hi + *lo is an
+ approximation of (h1+l1)/(h2+l2), assuming |l1| <= 1/2*ulp(h1)
+ and |l2| <= 1/2*ulp(h2), h2+l2 is not zero, and rounding to nearest. */
+static inline void
+div_expansion (double *hi, double *lo, double h1, double l1,
+ double h2, double l2)
+{
+ double r, e;
+
+ div_split (hi, lo, h1, h2);
+ /* (h1+l1)/(h2+l2) ~ h1/h2 + (l1*h2 - l2*h1)/h2^2 */
+ r = (l1 * h2 - l2 * h1) / (h2 * h2);
+ /* Now add r to (hi,lo) using fast two-sum, where we know |r| < |hi|. */
+ fast_two_sum (hi, &e, *hi, r);
+ *lo += e;
+ /* Renormalize since |lo| might be larger than 0.5 ulp(hi). */
+ fast_two_sum (hi, lo, *hi, *lo);
+}
+
#endif /* _MUL_SPLIT_H */