about summary refs log tree commit diff
path: root/sysdeps/ieee754/flt-32/e_exp2f.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/flt-32/e_exp2f.c')
-rw-r--r--sysdeps/ieee754/flt-32/e_exp2f.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sysdeps/ieee754/flt-32/e_exp2f.c b/sysdeps/ieee754/flt-32/e_exp2f.c
index f3e3a8e6fc..0b75a7ea2a 100644
--- a/sysdeps/ieee754/flt-32/e_exp2f.c
+++ b/sysdeps/ieee754/flt-32/e_exp2f.c
@@ -89,7 +89,9 @@ __ieee754_exp2f (float x)
 	/* 3. Compute ex2 = 2^(t/255+e+ex).  */
 	ex2_u.f = __exp2f_atable[tval & 255];
 	tval >>= 8;
-	unsafe = abs(tval) >= -FLT_MIN_EXP - 1;
+	/* x2 is an integer multiple of 2^-30; avoid intermediate
+	   underflow from the calculation of x22 * x.  */
+	unsafe = abs(tval) >= -FLT_MIN_EXP - 32;
 	ex2_u.ieee.exponent += tval >> unsafe;
 	scale_u.f = 1.0;
 	scale_u.ieee.exponent += tval - (tval >> unsafe);