From 41498f4db1ebfeb2fb76b9137cba38c20000f1d3 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Sat, 5 May 2012 19:37:39 +0000 Subject: Fix missing exceptions from exp (bugs 13787, 13922, 14036). --- sysdeps/ieee754/flt-32/w_expf.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'sysdeps/ieee754/flt-32/w_expf.c') diff --git a/sysdeps/ieee754/flt-32/w_expf.c b/sysdeps/ieee754/flt-32/w_expf.c index bc3b2f6790..bfef9e4d24 100644 --- a/sysdeps/ieee754/flt-32/w_expf.c +++ b/sysdeps/ieee754/flt-32/w_expf.c @@ -19,27 +19,16 @@ #include #include -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) -- cgit 1.4.1