aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/ldbl-128/e_j1l.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-06-29 17:51:32 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-06-29 17:51:32 +0000
commit4aa10d01b654b7395c6e856b8e1e0959cfc80739 (patch)
tree01a52e164acecacf0e5b0e1851740d5defcd9d34 /sysdeps/ieee754/ldbl-128/e_j1l.c
parent63dbe5f32238858c7b953b867ed0588c7808dd4f (diff)
downloadglibc-4aa10d01b654b7395c6e856b8e1e0959cfc80739.tar
glibc-4aa10d01b654b7395c6e856b8e1e0959cfc80739.tar.gz
glibc-4aa10d01b654b7395c6e856b8e1e0959cfc80739.tar.bz2
glibc-4aa10d01b654b7395c6e856b8e1e0959cfc80739.zip
Fix ldbl-128 j1l spurious underflows (bug 18612).
The ldbl-128 implementation of j1l produces spurious underflow exceptions for some small arguments, as a result of squaring the argument. This patch fixes it just to use a linear approximation for sufficiently small arguments, and then to force an underflow exception only in the cases where it is required. Tested for mips64. [BZ #18612] * sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_j1l): For small arguments, just return 0.5 times the argument, with underflow forced as needed. * math/auto-libm-test-in: Add more tests of j1. * math/auto-libm-test-out: Regenerated.
Diffstat (limited to 'sysdeps/ieee754/ldbl-128/e_j1l.c')
-rw-r--r--sysdeps/ieee754/ldbl-128/e_j1l.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-128/e_j1l.c b/sysdeps/ieee754/ldbl-128/e_j1l.c
index 958077d927..591c38efd0 100644
--- a/sysdeps/ieee754/ldbl-128/e_j1l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j1l.c
@@ -697,6 +697,16 @@ __ieee754_j1l (long double x)
if (x == 0.0L)
return x;
xx = fabsl (x);
+ if (xx <= 0x1p-58L)
+ {
+ long double ret = x * 0.5L;
+ if (fabsl (ret) < LDBL_MIN)
+ {
+ long double force_underflow = ret * ret;
+ math_force_eval (force_underflow);
+ }
+ return ret;
+ }
if (xx <= 2.0L)
{
/* 0 <= x <= 2 */