about summary refs log tree commit diff
path: root/math/auto-libm-test-in
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-06-23 14:35:18 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-06-23 14:35:18 +0000
commitb59549574efeeecf124de05c9183c120eaaa56f0 (patch)
treeae18151390fc556d7ad3fa74246b032ce9dd6db8 /math/auto-libm-test-in
parentb57525f1a376149840f740a31535681c07152ba4 (diff)
downloadglibc-b59549574efeeecf124de05c9183c120eaaa56f0.tar.gz
glibc-b59549574efeeecf124de05c9183c120eaaa56f0.tar.xz
glibc-b59549574efeeecf124de05c9183c120eaaa56f0.zip
Fix exp2, exp2f spurious underflows (bug 18219).
The dbl-64 and flt-32 implementations of exp2 functions produce
spurious underflow exceptions.  The underlying reason is the same in
both cases: the computation works as (2^a - 1)*2^b + 2^b for suitably
chosen a and b, where a has small magnitude so 2^a - 1 can be computed
with a low-degree polynomial approximation, and (2^a - 1)*2^b can
underflow even when the final result does not.  This patch fixes this
by adjusting the threshold for when scaling is used to avoid
intermediate underflow so it works for any possible value of a where
the final result would not underflow.

Tested for x86_64 and x86.

	[BZ #18219]
	* sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Reduce
	threshold on absolute value of exponent for which scaling is used.
	* sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Likewise.
	* math/auto-libm-test-in: Add more tests of exp2.
	* math/auto-libm-test-out: Regenerated.
Diffstat (limited to 'math/auto-libm-test-in')
-rw-r--r--math/auto-libm-test-in7
1 files changed, 7 insertions, 0 deletions
diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 9bae9d5570..cf7fc359b0 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -1271,9 +1271,16 @@ exp2 max
 exp2 -max
 exp2 0.75
 exp2 100.5
+exp2 -116.5
+exp2 -123.5
+exp2 -124.5
+exp2 -125.5
 exp2 127
 exp2 -149
 exp2 1000.25
+exp2 -1019.5
+exp2 -1020.5
+exp2 -1021.5
 exp2 1023
 exp2 -1074
 exp2 16383