This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix ldbl-96, ldbl-128ibm atanhl inaccuracy (bug 18046, bug 18047) [committed]


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.  Committed.

(auto-libm-test-out diffs omitted below.)

2015-02-27  Joseph Myers  <joseph@codesourcery.com>

	[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.

diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 19d5396..5e4b84d 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -300,7 +300,38 @@ atanh 0.25
 atanh 0x1p-5
 atanh 0x1p-10
 atanh 0x1.2345p-20
+atanh 0x1p-8
+atanh 0x1p-9
+atanh 0x1p-10
+atanh 0x1p-11
+atanh 0x1p-12
+atanh 0x1p-13
+atanh 0x1p-24
+atanh 0x1p-25
+atanh 0x1p-26
+atanh 0x1p-27
+atanh 0x1p-28
+atanh 0x1p-29
+atanh 0x1p-30
+atanh 0x1p-31
+atanh 0x1p-32
+atanh 0x1p-33
+atanh 0x1p-48
+atanh 0x1p-49
+atanh 0x1p-50
+atanh 0x1p-51
+atanh 0x1p-52
+atanh 0x1p-53
+atanh 0x1p-54
+atanh 0x1p-55
+atanh 0x1p-56
+atanh 0x1p-57
+atanh 0x1p-58
+atanh 0x1p-59
+atanh 0x1p-100
 # Bug 16352: underflow exception may be missing.
+atanh 0x1p-500 missing-underflow
+atanh 0x1p-5000 missing-underflow
 atanh min missing-underflow
 atanh -min missing-underflow
 atanh min_subnorm missing-underflow
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 3ba23a4..302ea4c 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 29f2e92..5a98999 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 4c29243..305d50e 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 7252929..5cfb73f 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

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]