Skip to content

Commit

Permalink
Fix ldbl-96, ldbl-128ibm atanhl inaccuracy (bug 18046, bug 18047).
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Joseph Myers committed Feb 27, 2015
1 parent af96be3 commit 2ca725c
Show file tree
Hide file tree
Showing 8 changed files with 930 additions and 4 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
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.

2015-02-27 Wilco Dijkstra wdijkstr@arm.com

* string/bcopy.c (bcopy): Call memmove for performance.
Expand Down
3 changes: 2 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Version 2.22
4719, 14841, 13064, 14094, 15319, 15467, 15790, 15969, 16351, 16560,
16783, 17269, 17523, 17569, 17588, 17792, 17836, 17912, 17916, 17932,
17944, 17949, 17964, 17965, 17967, 17969, 17978, 17987, 17991, 17996,
17998, 17999, 18019, 18020, 18029, 18030, 18032, 18038, 18039.
17998, 17999, 18019, 18020, 18029, 18030, 18032, 18038, 18039, 18046,
18047.

* Character encoding and ctype tables were updated to Unicode 7.0.0, using
new generator scripts contributed by Pravin Satpute and Mike FABIAN (Red
Expand Down
31 changes: 31 additions & 0 deletions math/auto-libm-test-in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
875 changes: 875 additions & 0 deletions math/auto-libm-test-out

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions sysdeps/i386/fpu/libm-test-ulps
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ ildouble: 2
ldouble: 1

Function: "atanh_towardzero":
double: 1
float: 1
idouble: 1
ifloat: 1
ildouble: 4
Expand Down
2 changes: 1 addition & 1 deletion sysdeps/ieee754/ldbl-128ibm/e_atanhl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions sysdeps/ieee754/ldbl-96/e_atanhl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 4 additions & 0 deletions sysdeps/x86_64/fpu/libm-test-ulps
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ ildouble: 1
ldouble: 1

Function: "atanh":
double: 1
float: 1
idouble: 1
ifloat: 1
ildouble: 1
ldouble: 1
Expand All @@ -184,7 +186,9 @@ ildouble: 2
ldouble: 2

Function: "atanh_towardzero":
double: 1
float: 1
idouble: 1
ifloat: 1
ildouble: 2
ldouble: 2
Expand Down

0 comments on commit 2ca725c

Please sign in to comment.