about summary refs log tree commit diff
path: root/sysdeps/ieee754/flt-32/w_expf.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-05-05 19:37:39 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-05-05 19:37:39 +0000
commit41498f4db1ebfeb2fb76b9137cba38c20000f1d3 (patch)
treee546d5a208020a4dc1598ea46d5c819e9a1a20c0 /sysdeps/ieee754/flt-32/w_expf.c
parent6698b8bf4365f09d5bb467e113068f210811b001 (diff)
downloadglibc-41498f4db1ebfeb2fb76b9137cba38c20000f1d3.tar.gz
glibc-41498f4db1ebfeb2fb76b9137cba38c20000f1d3.tar.xz
glibc-41498f4db1ebfeb2fb76b9137cba38c20000f1d3.zip
Fix missing exceptions from exp (bugs 13787, 13922, 14036).
Diffstat (limited to 'sysdeps/ieee754/flt-32/w_expf.c')
-rw-r--r--sysdeps/ieee754/flt-32/w_expf.c21
1 files changed, 5 insertions, 16 deletions
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 <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)