diff options
author | Joseph Myers <joseph@codesourcery.com> | 2012-05-05 19:37:39 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2012-05-05 19:37:39 +0000 |
commit | 41498f4db1ebfeb2fb76b9137cba38c20000f1d3 (patch) | |
tree | e546d5a208020a4dc1598ea46d5c819e9a1a20c0 /sysdeps/ieee754/dbl-64/w_exp.c | |
parent | 6698b8bf4365f09d5bb467e113068f210811b001 (diff) | |
download | glibc-41498f4db1ebfeb2fb76b9137cba38c20000f1d3.tar.gz glibc-41498f4db1ebfeb2fb76b9137cba38c20000f1d3.tar.xz glibc-41498f4db1ebfeb2fb76b9137cba38c20000f1d3.zip |
Fix missing exceptions from exp (bugs 13787, 13922, 14036).
Diffstat (limited to 'sysdeps/ieee754/dbl-64/w_exp.c')
-rw-r--r-- | sysdeps/ieee754/dbl-64/w_exp.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/sysdeps/ieee754/dbl-64/w_exp.c b/sysdeps/ieee754/dbl-64/w_exp.c index aa8ff7689f..14328a7b4b 100644 --- a/sysdeps/ieee754/dbl-64/w_exp.c +++ b/sysdeps/ieee754/dbl-64/w_exp.c @@ -19,27 +19,16 @@ #include <math.h> #include <math_private.h> -static const double -o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */ -u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */ - - /* wrapper exp */ double __exp (double x) { - if (__builtin_expect (isgreater (x, o_threshold), 0)) - { - if (_LIB_VERSION != _IEEE_) - return __kernel_standard (x, x, 6); - } - else if (__builtin_expect (isless (x, u_threshold), 0)) - { - if (_LIB_VERSION != _IEEE_) - return __kernel_standard (x, x, 7); - } + double z = __ieee754_exp (x); + if (__builtin_expect (!__finite (z) || z == 0, 0) + && __finite (x) && _LIB_VERSION != _IEEE_) + return __kernel_standard (x, x, 6 + !!__signbit (x)); - return __ieee754_exp (x); + return z; } hidden_def (__exp) weak_alias (__exp, exp) |