diff options
author | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2013-03-28 09:52:48 -0300 |
---|---|---|
committer | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2013-03-28 09:52:48 -0300 |
commit | fbbe2b9a1f04c00ea0f8820a545bd4ca780ffa30 (patch) | |
tree | d19dde106630a713b2487d4bfd1374bfa721e02a /sysdeps/ieee754/ldbl-128ibm/e_logl.c | |
parent | 7a86be6e5f18ba99b25d75c555ce56fe1fcea325 (diff) | |
download | glibc-fbbe2b9a1f04c00ea0f8820a545bd4ca780ffa30.tar.gz glibc-fbbe2b9a1f04c00ea0f8820a545bd4ca780ffa30.tar.xz glibc-fbbe2b9a1f04c00ea0f8820a545bd4ca780ffa30.zip |
Fix e_logl (128ibm) spurious underflow
Diffstat (limited to 'sysdeps/ieee754/ldbl-128ibm/e_logl.c')
-rw-r--r-- | sysdeps/ieee754/ldbl-128ibm/e_logl.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_logl.c b/sysdeps/ieee754/ldbl-128ibm/e_logl.c index 14f47ebade..15b5edfab3 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_logl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_logl.c @@ -182,6 +182,9 @@ static const long double ln2a = 6.93145751953125e-1L, ln2b = 1.4286068203094172321214581765680755001344E-6L; +static const long double + ldbl_epsilon = 0x1p-106L; + long double __ieee754_logl(long double x) { @@ -258,7 +261,12 @@ __ieee754_logl(long double x) } /* Series expansion of log(1+z). */ w = z * z; - y = ((((((((((((l15 * z + /* Avoid spurious underflows. */ + if (__glibc_unlikely(w <= ldbl_epsilon)) + y = 0.0L; + else + { + y = ((((((((((((l15 * z + l14) * z + l13) * z + l12) * z @@ -271,7 +279,8 @@ __ieee754_logl(long double x) + l5) * z + l4) * z + l3) * z * w; - y -= 0.5 * w; + y -= 0.5 * w; + } y += e * ln2b; /* Base 2 exponent offset times ln(2). */ y += z; y += logtbl[k-26]; /* log(t) - (t-1) */ |