aboutsummaryrefslogtreecommitdiff
path: root/libquadmath/math/log1pq.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-07-19 15:12:58 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-07-19 15:12:58 +0200
commit1eba0867060b1643d71d4185fbc23995248092bf (patch)
treeb933cf0474996b72f099f09c134fd321c9590600 /libquadmath/math/log1pq.c
parent564e405c138dc1891ca92462a585bf89444d7dd1 (diff)
downloadgcc-1eba0867060b1643d71d4185fbc23995248092bf.zip
gcc-1eba0867060b1643d71d4185fbc23995248092bf.tar.gz
gcc-1eba0867060b1643d71d4185fbc23995248092bf.tar.bz2
re PR libquadmath/65757 (gfortran gives incorrect result for anint with real*16 argument)
PR libquadmath/65757 * quadmath-imp.h (math_opt_barrier, math_force_eval, math_narrow_eval, math_check_force_underflow, math_check_force_underflow_nonneg): Define. * math/ceilq.c: Backport changes from upstream glibc between 2012-11-01 and 2017-07-13. * math/remquoq.c: Likewise. * math/expq.c: Likewise. * math/llroundq.c: Likewise. * math/logq.c: Likewise. * math/atanq.c: Likewise. * math/nearbyintq.c: Likewise. * math/scalblnq.c: Likewise. * math/finiteq.c: Likewise. * math/atanhq.c: Likewise. * math/expm1q.c: Likewise. * math/sinhq.c: Likewise. * math/log10q.c: Likewise. * math/rintq.c: Likewise. * math/roundq.c: Likewise. * math/fmaq.c: Likewise. * math/erfq.c: Likewise. * math/log2q.c: Likewise. * math/lroundq.c: Likewise. * math/j1q.c: Likewise. * math/scalbnq.c: Likewise. * math/truncq.c: Likewise. * math/frexpq.c: Likewise. * math/sincosq.c: Likewise. * math/tanhq.c: Likewise. * math/asinq.c: Likewise. * math/coshq.c: Likewise. * math/j0q.c: Likewise. * math/asinhq.c: Likewise. * math/floorq.c: Likewise. * math/sinq_kernel.c: Likewise. * math/powq.c: Likewise. * math/hypotq.c: Likewise. * math/sincos_table.c: Likewise. * math/rem_pio2q.c: Likewise. * math/nextafterq.c: Likewise. * math/log1pq.c: Likewise. * math/sincosq_kernel.c: Likewise. * math/tanq.c: Likewise. * math/acosq.c: Likewise. * math/lrintq.c: Likewise. * math/llrintq.c: Likewise. From-SVN: r250343
Diffstat (limited to 'libquadmath/math/log1pq.c')
-rw-r--r--libquadmath/math/log1pq.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libquadmath/math/log1pq.c b/libquadmath/math/log1pq.c
index d8bff40..c59ceef 100644
--- a/libquadmath/math/log1pq.c
+++ b/libquadmath/math/log1pq.c
@@ -36,7 +36,7 @@
* IEEE -1, 8 100000 1.9e-34 4.3e-35
*/
-/* Copyright 2001 by Stephen L. Moshier
+/* Copyright 2001 by Stephen L. Moshier
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -128,8 +128,8 @@ log1pq (__float128 xm1)
/* Test for NaN or infinity input. */
u.value = xm1;
hx = u.words32.w0;
- if (hx >= 0x7fff0000)
- return xm1;
+ if ((hx & 0x7fffffff) >= 0x7fff0000)
+ return xm1 + fabsq (xm1);
/* log1p(+- 0) = +- 0. */
if (((hx & 0x7fffffff) == 0)
@@ -138,17 +138,21 @@ log1pq (__float128 xm1)
if ((hx & 0x7fffffff) < 0x3f8e0000)
{
+ math_check_force_underflow (xm1);
if ((int) xm1 == 0)
return xm1;
}
- x = xm1 + 1.0Q;
+ if (xm1 >= 0x1p113Q)
+ x = xm1;
+ else
+ x = xm1 + 1.0Q;
/* log1p(-1) = -inf */
if (x <= 0.0Q)
{
if (x == 0.0Q)
- return (-1.0Q / (x - x));
+ return (-1.0Q / zero); /* log1p(-1) = -inf */
else
return (zero / (x - x));
}