diff options
author | Joseph Myers <joseph@codesourcery.com> | 2015-02-27 17:48:37 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2015-02-27 17:48:37 +0000 |
commit | 2ca725c594e0c186d928dc0823be7d8b5976112c (patch) | |
tree | 8f477bda16d5f94bb925301798e653d3064ee75d /sysdeps | |
parent | af96be34825586536ebcfbf5c675e795ddd3c8fa (diff) | |
download | glibc-2ca725c594e0c186d928dc0823be7d8b5976112c.tar.gz glibc-2ca725c594e0c186d928dc0823be7d8b5976112c.tar.xz glibc-2ca725c594e0c186d928dc0823be7d8b5976112c.zip |
Fix ldbl-96, ldbl-128ibm atanhl inaccuracy (bug 18046, bug 18047).
The threshold in ldbl-96 atanhl for when to return the argument, 0x1p-28, is a bit too big, and that in ldbl-128ibm atanhl is much too big (the relevant condition being x^3/3 being < 0.5ulp of x), resulting in errors a bit above the limits of those considered acceptable in glibc in the ldbl-96 case, and in large errors in the ldbl-128ibm case. This patch changes those implementations to use more appropriate thresholds and adds tests around the thresholds for various formats. Tested for x86_64, x86 and powerpc. x86_64 and x86 ulps updated accordingly. [BZ #18046] [BZ #18047] * sysdeps/ieee754/ldbl-128ibm/e_atanhl.c (__ieee754_atanhl): Use 0x1p-56L as threshold for just returning the argument. * sysdeps/ieee754/ldbl-96/e_atanhl.c (__ieee754_atanhl): Use 0x1p-32L as threshold for just returning the argument. * math/auto-libm-test-in: Add more tests of atanh. * math/auto-libm-test-out: Regenerated. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulp: Likewise.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/i386/fpu/libm-test-ulps | 2 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128ibm/e_atanhl.c | 2 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-96/e_atanhl.c | 4 | ||||
-rw-r--r-- | sysdeps/x86_64/fpu/libm-test-ulps | 4 |
4 files changed, 9 insertions, 3 deletions
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps index 3ba23a4fc5..302ea4c2b9 100644 --- a/sysdeps/i386/fpu/libm-test-ulps +++ b/sysdeps/i386/fpu/libm-test-ulps @@ -150,6 +150,8 @@ ildouble: 2 ldouble: 1 Function: "atanh_towardzero": +double: 1 +float: 1 idouble: 1 ifloat: 1 ildouble: 4 diff --git a/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c b/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c index 29f2e92072..5a989992f5 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c @@ -54,7 +54,7 @@ __ieee754_atanhl(long double x) if (t == one) return x/zero; } - if(ix<0x3e20000000000000LL&&(huge+x)>zero) return x; /* x<2**-29 */ + if(ix<0x3c70000000000000LL&&(huge+x)>zero) return x; /* x<2**-56 */ x = fabsl (x); if(ix<0x3fe0000000000000LL) { /* x < 0.5 */ t = x+x; diff --git a/sysdeps/ieee754/ldbl-96/e_atanhl.c b/sysdeps/ieee754/ldbl-96/e_atanhl.c index 4c29243695..305d50e309 100644 --- a/sysdeps/ieee754/ldbl-96/e_atanhl.c +++ b/sysdeps/ieee754/ldbl-96/e_atanhl.c @@ -52,9 +52,9 @@ __ieee754_atanhl(long double x) return (x-x)/(x-x); if(ix==0x3fff) return x/zero; - if(ix<0x3fe3) { + if(ix<0x3fdf) { math_force_eval(huge+x); - return x; /* x<2**-28 */ + return x; /* x<2**-32 */ } SET_LDOUBLE_EXP(x,ix); if(ix<0x3ffe) { /* x < 0.5 */ diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps index 72529291b8..5cfb73f900 100644 --- a/sysdeps/x86_64/fpu/libm-test-ulps +++ b/sysdeps/x86_64/fpu/libm-test-ulps @@ -170,7 +170,9 @@ ildouble: 1 ldouble: 1 Function: "atanh": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -184,7 +186,9 @@ ildouble: 2 ldouble: 2 Function: "atanh_towardzero": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 2 ldouble: 2 |