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 | |
parent | 6698b8bf4365f09d5bb467e113068f210811b001 (diff) | |
download | glibc-41498f4db1ebfeb2fb76b9137cba38c20000f1d3.zip glibc-41498f4db1ebfeb2fb76b9137cba38c20000f1d3.tar.gz glibc-41498f4db1ebfeb2fb76b9137cba38c20000f1d3.tar.bz2 |
Fix missing exceptions from exp (bugs 13787, 13922, 14036).
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r-- | sysdeps/ieee754/dbl-64/w_exp.c | 21 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/w_expf.c | 21 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-96/w_expl.c | 23 |
3 files changed, 15 insertions, 50 deletions
diff --git a/sysdeps/ieee754/dbl-64/w_exp.c b/sysdeps/ieee754/dbl-64/w_exp.c index aa8ff76..14328a7 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) diff --git a/sysdeps/ieee754/flt-32/w_expf.c b/sysdeps/ieee754/flt-32/w_expf.c index bc3b2f6..bfef9e4 100644 --- a/sysdeps/ieee754/flt-32/w_expf.c +++ b/sysdeps/ieee754/flt-32/w_expf.c @@ -19,27 +19,16 @@ #include <math.h> #include <math_private.h> -static const float -o_threshold= 8.8722831726e+01, /* 0x42b17217 */ -u_threshold= -1.0397208405e+02; /* 0xc2cff1b5 */ - - /* wrapper expf */ float __expf (float x) { - if (__builtin_expect (isgreater (x, o_threshold), 0)) - { - if (_LIB_VERSION != _IEEE_) - return __kernel_standard_f (x, x, 106); - } - else if (__builtin_expect (isless (x, u_threshold), 0)) - { - if (_LIB_VERSION != _IEEE_) - return __kernel_standard_f (x, x, 107); - } + float z = __ieee754_expf (x); + if (__builtin_expect (!__finitef (z) || z == 0, 0) + && __finitef (x) && _LIB_VERSION != _IEEE_) + return __kernel_standard_f (x, x, 106 + !!__signbitf (x)); - return __ieee754_expf (x); + return z; } hidden_def (__expf) weak_alias (__expf, expf) diff --git a/sysdeps/ieee754/ldbl-96/w_expl.c b/sysdeps/ieee754/ldbl-96/w_expl.c index 55c6846..79b10c5 100644 --- a/sysdeps/ieee754/ldbl-96/w_expl.c +++ b/sysdeps/ieee754/ldbl-96/w_expl.c @@ -19,29 +19,16 @@ #include <math.h> #include <math_private.h> -static const long double -o_threshold= 1.135652340629414394949193107797076489134e4, - /* 0x400C, 0xB17217F7, 0xD1CF79AC */ -u_threshold= -1.140019167866942050398521670162263001513e4; - /* 0x400C, 0xB220C447, 0x69C201E8 */ - - /* wrapper expl */ long double __expl (long double x) { - if (__builtin_expect (isgreater (x, o_threshold), 0)) - { - if (_LIB_VERSION != _IEEE_) - return __kernel_standard_l (x, x, 206); - } - else if (__builtin_expect (isless (x, u_threshold), 0)) - { - if (_LIB_VERSION != _IEEE_) - return __kernel_standard_l (x, x, 207); - } + long double z = __ieee754_expl (x); + if (__builtin_expect (!__finitel (z) || z == 0, 0) + && __finitel (x) && _LIB_VERSION != _IEEE_) + return __kernel_standard_l (x, x, 206 + !!__signbitl (x)); - return __ieee754_expl (x); + return z; } hidden_def (__expl) weak_alias (__expl, expl) |