diff options
author | Joseph Myers <joseph@codesourcery.com> | 2012-03-21 12:17:26 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2012-03-21 12:17:26 +0000 |
commit | 0cb7efc517a293417880f02e2991483b7ce1e3f9 (patch) | |
tree | 6c0c2e224abce394aa9713bf8de43d4ff8012bdb /math/w_exp2l.c | |
parent | 2460d3aa21f04cdf28497683bd3e29183189f779 (diff) | |
download | glibc-0cb7efc517a293417880f02e2991483b7ce1e3f9.tar.gz glibc-0cb7efc517a293417880f02e2991483b7ce1e3f9.tar.xz glibc-0cb7efc517a293417880f02e2991483b7ce1e3f9.zip |
Fix missing exp2 overflow exception (bug 13871).
Diffstat (limited to 'math/w_exp2l.c')
-rw-r--r-- | math/w_exp2l.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/math/w_exp2l.c b/math/w_exp2l.c index 442a637347..f05a8fe6d6 100644 --- a/math/w_exp2l.c +++ b/math/w_exp2l.c @@ -2,23 +2,18 @@ * wrapper exp2l(x) */ -#include <float.h> #include <math.h> #include <math_private.h> -static const long double o_threshold = (long double) LDBL_MAX_EXP; -static const long double u_threshold - = (long double) (LDBL_MIN_EXP - LDBL_MANT_DIG - 1); - long double __exp2l (long double x) { - if (__builtin_expect (islessequal (x, u_threshold) - || isgreater (x, o_threshold), 0) - && _LIB_VERSION != _IEEE_ && __finitel (x)) + long double z = __ieee754_exp2l (x); + if (__builtin_expect (!__finitel (z), 0) + && __finitel (x) && _LIB_VERSION != _IEEE_) /* exp2 overflow: 244, exp2 underflow: 245 */ - return __kernel_standard (x, x, 244 + (x <= o_threshold)); + return __kernel_standard (x, x, 244 + !!__signbitl (x)); - return __ieee754_exp2l (x); + return z; } weak_alias (__exp2l, exp2l) |