diff options
Diffstat (limited to 'libc/sysdeps/ieee754/flt-32/e_expf.c')
-rw-r--r-- | libc/sysdeps/ieee754/flt-32/e_expf.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/libc/sysdeps/ieee754/flt-32/e_expf.c b/libc/sysdeps/ieee754/flt-32/e_expf.c index b9cd53c03..02105c438 100644 --- a/libc/sysdeps/ieee754/flt-32/e_expf.c +++ b/libc/sysdeps/ieee754/flt-32/e_expf.c @@ -1,5 +1,5 @@ /* Single-precision floating point e^x. - Copyright (C) 1997, 1998, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2005, 2006, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Geoffrey Keating <geoffk@ozemail.com.au> @@ -33,8 +33,8 @@ Then e^x is approximated as e^x = 2^n ( e^(t/512 + delta[t]) - + ( e^(t/512 + delta[t]) - * ( p(x + delta[t] + n * ln(2)) - delta ) ) ) + + ( e^(t/512 + delta[t]) + * ( p(x + delta[t] + n * ln(2)) - delta ) ) ) where - p(x) is a polynomial approximating e(x)-1; @@ -47,9 +47,6 @@ to perform an 'accurate table method' expf, because of the range reduction overhead (compare exp2f). */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif #include <float.h> #include <ieee754.h> #include <math.h> @@ -60,8 +57,8 @@ extern const float __exp_deltatable[178]; extern const double __exp_atable[355] /* __attribute__((mode(DF))) */; -static const volatile float TWOM100 = 7.88860905e-31; -static const volatile float TWO127 = 1.7014118346e+38; +static const float TWOM100 = 7.88860905e-31; +static const float TWO127 = 1.7014118346e+38; float __ieee754_expf (float x) @@ -86,10 +83,7 @@ __ieee754_expf (float x) union ieee754_double ex2_u; fenv_t oldenv; - feholdexcept (&oldenv); -#ifdef FE_TONEAREST - fesetround (FE_TONEAREST); -#endif + libc_feholdexcept_setroundf (&oldenv, FE_TONEAREST); /* Calculate n. */ n = x * M_1_LN2 + THREEp22; @@ -119,7 +113,7 @@ __ieee754_expf (float x) x22 = (0.5000000496709180453 * dx + 1.0000001192102037084) * dx + delta; /* Return result. */ - fesetenv (&oldenv); + libc_fesetenvf (&oldenv); result = x22 * ex2_u.d + ex2_u.d; return (float) result; @@ -138,3 +132,4 @@ __ieee754_expf (float x) /* Return x, if x is a NaN or Inf; or overflow, otherwise. */ return TWO127*x; } +strong_alias (__ieee754_expf, __expf_finite) |