summaryrefslogtreecommitdiff
path: root/libquadmath/math/expq.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/expq.c
parent564e405c138dc1891ca92462a585bf89444d7dd1 (diff)
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/expq.c')
-rw-r--r--libquadmath/math/expq.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libquadmath/math/expq.c b/libquadmath/math/expq.c
index 70c638d7a08..5df6cd8e192 100644
--- a/libquadmath/math/expq.c
+++ b/libquadmath/math/expq.c
@@ -1,5 +1,5 @@
/* Quad-precision floating point e^x.
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jj@ultra.linux.cz>
Partly based on double-precision code
@@ -1075,7 +1075,7 @@ static const __float128 C[] = {
#define TWO15 C[11]
32768.0Q,
-/* Chebyshev polynom coeficients for (exp(x)-1)/x */
+/* Chebyshev polynom coefficients for (exp(x)-1)/x */
#define P1 C[12]
#define P2 C[13]
#define P3 C[14]
@@ -1142,7 +1142,7 @@ expq (__float128 x)
* __expq_table[T_EXPL_RES2 + tval2];
n_i = (int)n;
/* 'unsafe' is 1 iff n_1 != 0. */
- unsafe = abs(n_i) >= -FLT128_MIN_EXP - 1;
+ unsafe = abs(n_i) >= 15000;
ex2_u.ieee.exponent += n_i >> unsafe;
/* Compute scale = 2^n_1. */
@@ -1179,7 +1179,7 @@ expq (__float128 x)
ex3_u.d = (result - ex2_u.d) - x22 * ex2_u.d;
ex2_u.d = result;
ex3_u.ieee.exponent += LDBL_MANT_DIG + 15 + IEEE854_LONG_DOUBLE_BIAS
- - ex2_u.ieee.exponent;
+ - ex2_u.ieee.exponent;
n_i = abs (ex3_u.d);
n_i = (n_i + 1) / 2;
#ifdef USE_FENV_H
@@ -1196,7 +1196,11 @@ expq (__float128 x)
if (!unsafe)
return result;
else
- return result * scale_u.value;
+ {
+ result *= scale_u.value;
+ math_check_force_underflow_nonneg (result);
+ return result;
+ }
}
/* Exceptional cases: */
else if (__builtin_isless (x, himark))