diff options
author | Richard Henderson <rth@twiddle.net> | 2012-03-10 08:55:53 -0800 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2012-03-19 06:49:44 -0700 |
commit | eb92c487b35e26aa1e08815c4480d0bc5cc9f370 (patch) | |
tree | 99b3d94fcac1b61ea4c23f5575c109508db5e590 /sysdeps/ieee754/flt-32/e_expf.c | |
parent | 7d2e8012cfb4fa30086ef330ef1b993cfcc3dd99 (diff) | |
download | glibc-eb92c487b35e26aa1e08815c4480d0bc5cc9f370.tar.gz glibc-eb92c487b35e26aa1e08815c4480d0bc5cc9f370.tar.xz glibc-eb92c487b35e26aa1e08815c4480d0bc5cc9f370.zip |
Create and use SET_RESTORE_ROUND{,_NOEX,_53BIT}{,F,L}.
Diffstat (limited to 'sysdeps/ieee754/flt-32/e_expf.c')
-rw-r--r-- | sysdeps/ieee754/flt-32/e_expf.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/sysdeps/ieee754/flt-32/e_expf.c b/sysdeps/ieee754/flt-32/e_expf.c index e69e7f6ae0..57aff16ab7 100644 --- a/sysdeps/ieee754/flt-32/e_expf.c +++ b/sysdeps/ieee754/flt-32/e_expf.c @@ -80,40 +80,39 @@ __ieee754_expf (float x) double x22, t, result, dx; float n, delta; union ieee754_double ex2_u; - fenv_t oldenv; - libc_feholdexcept_setroundf (&oldenv, FE_TONEAREST); + { + SET_RESTORE_ROUND_NOEXF (FE_TONEAREST); - /* Calculate n. */ - n = x * M_1_LN2 + THREEp22; - n -= THREEp22; - dx = x - n*M_LN2; + /* Calculate n. */ + n = x * M_1_LN2 + THREEp22; + n -= THREEp22; + dx = x - n*M_LN2; - /* Calculate t/512. */ - t = dx + THREEp42; - t -= THREEp42; - dx -= t; + /* Calculate t/512. */ + t = dx + THREEp42; + t -= THREEp42; + dx -= t; - /* Compute tval = t. */ - tval = (int) (t * 512.0); + /* Compute tval = t. */ + tval = (int) (t * 512.0); - if (t >= 0) - delta = - __exp_deltatable[tval]; - else - delta = __exp_deltatable[-tval]; + if (t >= 0) + delta = - __exp_deltatable[tval]; + else + delta = __exp_deltatable[-tval]; - /* Compute ex2 = 2^n e^(t/512+delta[t]). */ - ex2_u.d = __exp_atable[tval+177]; - ex2_u.ieee.exponent += (int) n; + /* Compute ex2 = 2^n e^(t/512+delta[t]). */ + ex2_u.d = __exp_atable[tval+177]; + ex2_u.ieee.exponent += (int) n; - /* Approximate e^(dx+delta) - 1, using a second-degree polynomial, - with maximum error in [-2^-10-2^-28,2^-10+2^-28] - less than 5e-11. */ - x22 = (0.5000000496709180453 * dx + 1.0000001192102037084) * dx + delta; + /* Approximate e^(dx+delta) - 1, using a second-degree polynomial, + with maximum error in [-2^-10-2^-28,2^-10+2^-28] + less than 5e-11. */ + x22 = (0.5000000496709180453 * dx + 1.0000001192102037084) * dx + delta; + } /* Return result. */ - libc_fesetenvf (&oldenv); - result = x22 * ex2_u.d + ex2_u.d; return (float) result; } |