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.
This commit is contained in:
Joseph Myers 2015-06-23 14:35:18 +00:00
parent b57525f1a3
commit b59549574e
6 changed files with 203 additions and 8 deletions

View File

@ -1,3 +1,12 @@
2015-06-23 Joseph Myers <joseph@codesourcery.com>
[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.
2015-06-23 Dmitry V. Levin <ldv@altlinux.org> 2015-06-23 Dmitry V. Levin <ldv@altlinux.org>
[BZ #17977] [BZ #17977]

12
NEWS
View File

@ -18,12 +18,12 @@ Version 2.22
17991, 17996, 17998, 17999, 18007, 18019, 18020, 18029, 18030, 18032, 17991, 17996, 17998, 17999, 18007, 18019, 18020, 18029, 18030, 18032,
18034, 18036, 18038, 18039, 18042, 18043, 18046, 18047, 18049, 18068, 18034, 18036, 18038, 18039, 18042, 18043, 18046, 18047, 18049, 18068,
18080, 18093, 18100, 18104, 18110, 18111, 18116, 18125, 18128, 18138, 18080, 18093, 18100, 18104, 18110, 18111, 18116, 18125, 18128, 18138,
18185, 18196, 18197, 18206, 18210, 18211, 18217, 18220, 18221, 18234, 18185, 18196, 18197, 18206, 18210, 18211, 18217, 18219, 18220, 18221,
18244, 18247, 18287, 18319, 18324, 18333, 18346, 18397, 18409, 18410, 18234, 18244, 18247, 18287, 18319, 18324, 18333, 18346, 18397, 18409,
18412, 18418, 18422, 18434, 18444, 18468, 18469, 18470, 18479, 18483, 18410, 18412, 18418, 18422, 18434, 18444, 18468, 18469, 18470, 18479,
18495, 18496, 18497, 18498, 18507, 18512, 18513, 18519, 18520, 18522, 18483, 18495, 18496, 18497, 18498, 18507, 18512, 18513, 18519, 18520,
18527, 18528, 18529, 18530, 18532, 18533, 18534, 18536, 18539, 18540, 18522, 18527, 18528, 18529, 18530, 18532, 18533, 18534, 18536, 18539,
18542, 18544, 18545, 18546, 18547, 18553, 18558, 18569. 18540, 18542, 18544, 18545, 18546, 18547, 18553, 18558, 18569.
* Cache information can be queried via sysconf() function on s390 e.g. with * Cache information can be queried via sysconf() function on s390 e.g. with
_SC_LEVEL1_ICACHE_SIZE as argument. _SC_LEVEL1_ICACHE_SIZE as argument.

View File

@ -1271,9 +1271,16 @@ exp2 max
exp2 -max exp2 -max
exp2 0.75 exp2 0.75
exp2 100.5 exp2 100.5
exp2 -116.5
exp2 -123.5
exp2 -124.5
exp2 -125.5
exp2 127 exp2 127
exp2 -149 exp2 -149
exp2 1000.25 exp2 1000.25
exp2 -1019.5
exp2 -1020.5
exp2 -1021.5
exp2 1023 exp2 1023
exp2 -1074 exp2 -1074
exp2 16383 exp2 16383

View File

@ -106691,6 +106691,106 @@ exp2 100.5
= exp2 tonearest ldbl-128ibm 0x6.48p+4L : 0x1.6a09e667f3bcc908b2fb1366ea8p+100L : inexact-ok = exp2 tonearest ldbl-128ibm 0x6.48p+4L : 0x1.6a09e667f3bcc908b2fb1366ea8p+100L : inexact-ok
= exp2 towardzero ldbl-128ibm 0x6.48p+4L : 0x1.6a09e667f3bcc908b2fb1366ea8p+100L : inexact-ok = exp2 towardzero ldbl-128ibm 0x6.48p+4L : 0x1.6a09e667f3bcc908b2fb1366ea8p+100L : inexact-ok
= exp2 upward ldbl-128ibm 0x6.48p+4L : 0x1.6a09e667f3bcc908b2fb1366ebp+100L : inexact-ok = exp2 upward ldbl-128ibm 0x6.48p+4L : 0x1.6a09e667f3bcc908b2fb1366ebp+100L : inexact-ok
exp2 -116.5
= exp2 downward flt-32 -0x7.48p+4f : 0xb.504f3p-120f : inexact-ok
= exp2 tonearest flt-32 -0x7.48p+4f : 0xb.504f3p-120f : inexact-ok
= exp2 towardzero flt-32 -0x7.48p+4f : 0xb.504f3p-120f : inexact-ok
= exp2 upward flt-32 -0x7.48p+4f : 0xb.504f4p-120f : inexact-ok
= exp2 downward dbl-64 -0x7.48p+4 : 0xb.504f333f9de6p-120 : inexact-ok
= exp2 tonearest dbl-64 -0x7.48p+4 : 0xb.504f333f9de68p-120 : inexact-ok
= exp2 towardzero dbl-64 -0x7.48p+4 : 0xb.504f333f9de6p-120 : inexact-ok
= exp2 upward dbl-64 -0x7.48p+4 : 0xb.504f333f9de68p-120 : inexact-ok
= exp2 downward ldbl-96-intel -0x7.48p+4L : 0xb.504f333f9de6484p-120L : inexact-ok
= exp2 tonearest ldbl-96-intel -0x7.48p+4L : 0xb.504f333f9de6484p-120L : inexact-ok
= exp2 towardzero ldbl-96-intel -0x7.48p+4L : 0xb.504f333f9de6484p-120L : inexact-ok
= exp2 upward ldbl-96-intel -0x7.48p+4L : 0xb.504f333f9de6485p-120L : inexact-ok
= exp2 downward ldbl-96-m68k -0x7.48p+4L : 0xb.504f333f9de6484p-120L : inexact-ok
= exp2 tonearest ldbl-96-m68k -0x7.48p+4L : 0xb.504f333f9de6484p-120L : inexact-ok
= exp2 towardzero ldbl-96-m68k -0x7.48p+4L : 0xb.504f333f9de6484p-120L : inexact-ok
= exp2 upward ldbl-96-m68k -0x7.48p+4L : 0xb.504f333f9de6485p-120L : inexact-ok
= exp2 downward ldbl-128 -0x7.48p+4L : 0xb.504f333f9de6484597d89b3754a8p-120L : inexact-ok
= exp2 tonearest ldbl-128 -0x7.48p+4L : 0xb.504f333f9de6484597d89b3754a8p-120L : inexact-ok
= exp2 towardzero ldbl-128 -0x7.48p+4L : 0xb.504f333f9de6484597d89b3754a8p-120L : inexact-ok
= exp2 upward ldbl-128 -0x7.48p+4L : 0xb.504f333f9de6484597d89b3754bp-120L : inexact-ok
= exp2 downward ldbl-128ibm -0x7.48p+4L : 0xb.504f333f9de6484597d89b3754p-120L : inexact-ok
= exp2 tonearest ldbl-128ibm -0x7.48p+4L : 0xb.504f333f9de6484597d89b3754p-120L : inexact-ok
= exp2 towardzero ldbl-128ibm -0x7.48p+4L : 0xb.504f333f9de6484597d89b3754p-120L : inexact-ok
= exp2 upward ldbl-128ibm -0x7.48p+4L : 0xb.504f333f9de6484597d89b3758p-120L : inexact-ok
exp2 -123.5
= exp2 downward flt-32 -0x7.b8p+4f : 0x1.6a09e6p-124f : inexact-ok
= exp2 tonearest flt-32 -0x7.b8p+4f : 0x1.6a09e6p-124f : inexact-ok
= exp2 towardzero flt-32 -0x7.b8p+4f : 0x1.6a09e6p-124f : inexact-ok
= exp2 upward flt-32 -0x7.b8p+4f : 0x1.6a09e8p-124f : inexact-ok
= exp2 downward dbl-64 -0x7.b8p+4 : 0x1.6a09e667f3bccp-124 : inexact-ok
= exp2 tonearest dbl-64 -0x7.b8p+4 : 0x1.6a09e667f3bcdp-124 : inexact-ok
= exp2 towardzero dbl-64 -0x7.b8p+4 : 0x1.6a09e667f3bccp-124 : inexact-ok
= exp2 upward dbl-64 -0x7.b8p+4 : 0x1.6a09e667f3bcdp-124 : inexact-ok
= exp2 downward ldbl-96-intel -0x7.b8p+4L : 0x1.6a09e667f3bcc908p-124L : inexact-ok
= exp2 tonearest ldbl-96-intel -0x7.b8p+4L : 0x1.6a09e667f3bcc908p-124L : inexact-ok
= exp2 towardzero ldbl-96-intel -0x7.b8p+4L : 0x1.6a09e667f3bcc908p-124L : inexact-ok
= exp2 upward ldbl-96-intel -0x7.b8p+4L : 0x1.6a09e667f3bcc90ap-124L : inexact-ok
= exp2 downward ldbl-96-m68k -0x7.b8p+4L : 0x1.6a09e667f3bcc908p-124L : inexact-ok
= exp2 tonearest ldbl-96-m68k -0x7.b8p+4L : 0x1.6a09e667f3bcc908p-124L : inexact-ok
= exp2 towardzero ldbl-96-m68k -0x7.b8p+4L : 0x1.6a09e667f3bcc908p-124L : inexact-ok
= exp2 upward ldbl-96-m68k -0x7.b8p+4L : 0x1.6a09e667f3bcc90ap-124L : inexact-ok
= exp2 downward ldbl-128 -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ea95p-124L : inexact-ok
= exp2 tonearest ldbl-128 -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ea95p-124L : inexact-ok
= exp2 towardzero ldbl-128 -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ea95p-124L : inexact-ok
= exp2 upward ldbl-128 -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ea96p-124L : inexact-ok
= exp2 downward ldbl-128ibm -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ea8p-124L : inexact-ok
= exp2 tonearest ldbl-128ibm -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ea8p-124L : inexact-ok
= exp2 towardzero ldbl-128ibm -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ea8p-124L : inexact-ok
= exp2 upward ldbl-128ibm -0x7.b8p+4L : 0x1.6a09e667f3bcc908b2fb1366ebp-124L : inexact-ok
exp2 -124.5
= exp2 downward flt-32 -0x7.c8p+4f : 0xb.504f3p-128f : inexact-ok
= exp2 tonearest flt-32 -0x7.c8p+4f : 0xb.504f3p-128f : inexact-ok
= exp2 towardzero flt-32 -0x7.c8p+4f : 0xb.504f3p-128f : inexact-ok
= exp2 upward flt-32 -0x7.c8p+4f : 0xb.504f4p-128f : inexact-ok
= exp2 downward dbl-64 -0x7.c8p+4 : 0xb.504f333f9de6p-128 : inexact-ok
= exp2 tonearest dbl-64 -0x7.c8p+4 : 0xb.504f333f9de68p-128 : inexact-ok
= exp2 towardzero dbl-64 -0x7.c8p+4 : 0xb.504f333f9de6p-128 : inexact-ok
= exp2 upward dbl-64 -0x7.c8p+4 : 0xb.504f333f9de68p-128 : inexact-ok
= exp2 downward ldbl-96-intel -0x7.c8p+4L : 0xb.504f333f9de6484p-128L : inexact-ok
= exp2 tonearest ldbl-96-intel -0x7.c8p+4L : 0xb.504f333f9de6484p-128L : inexact-ok
= exp2 towardzero ldbl-96-intel -0x7.c8p+4L : 0xb.504f333f9de6484p-128L : inexact-ok
= exp2 upward ldbl-96-intel -0x7.c8p+4L : 0xb.504f333f9de6485p-128L : inexact-ok
= exp2 downward ldbl-96-m68k -0x7.c8p+4L : 0xb.504f333f9de6484p-128L : inexact-ok
= exp2 tonearest ldbl-96-m68k -0x7.c8p+4L : 0xb.504f333f9de6484p-128L : inexact-ok
= exp2 towardzero ldbl-96-m68k -0x7.c8p+4L : 0xb.504f333f9de6484p-128L : inexact-ok
= exp2 upward ldbl-96-m68k -0x7.c8p+4L : 0xb.504f333f9de6485p-128L : inexact-ok
= exp2 downward ldbl-128 -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3754a8p-128L : inexact-ok
= exp2 tonearest ldbl-128 -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3754a8p-128L : inexact-ok
= exp2 towardzero ldbl-128 -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3754a8p-128L : inexact-ok
= exp2 upward ldbl-128 -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3754bp-128L : inexact-ok
= exp2 downward ldbl-128ibm -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3754p-128L : inexact-ok
= exp2 tonearest ldbl-128ibm -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3754p-128L : inexact-ok
= exp2 towardzero ldbl-128ibm -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3754p-128L : inexact-ok
= exp2 upward ldbl-128ibm -0x7.c8p+4L : 0xb.504f333f9de6484597d89b3758p-128L : inexact-ok
exp2 -125.5
= exp2 downward flt-32 -0x7.d8p+4f : 0x5.a82798p-128f : inexact-ok
= exp2 tonearest flt-32 -0x7.d8p+4f : 0x5.a82798p-128f : inexact-ok
= exp2 towardzero flt-32 -0x7.d8p+4f : 0x5.a82798p-128f : inexact-ok
= exp2 upward flt-32 -0x7.d8p+4f : 0x5.a827ap-128f : inexact-ok
= exp2 downward dbl-64 -0x7.d8p+4 : 0x5.a827999fcef3p-128 : inexact-ok
= exp2 tonearest dbl-64 -0x7.d8p+4 : 0x5.a827999fcef34p-128 : inexact-ok
= exp2 towardzero dbl-64 -0x7.d8p+4 : 0x5.a827999fcef3p-128 : inexact-ok
= exp2 upward dbl-64 -0x7.d8p+4 : 0x5.a827999fcef34p-128 : inexact-ok
= exp2 downward ldbl-96-intel -0x7.d8p+4L : 0x5.a827999fcef3242p-128L : inexact-ok
= exp2 tonearest ldbl-96-intel -0x7.d8p+4L : 0x5.a827999fcef3242p-128L : inexact-ok
= exp2 towardzero ldbl-96-intel -0x7.d8p+4L : 0x5.a827999fcef3242p-128L : inexact-ok
= exp2 upward ldbl-96-intel -0x7.d8p+4L : 0x5.a827999fcef32428p-128L : inexact-ok
= exp2 downward ldbl-96-m68k -0x7.d8p+4L : 0x5.a827999fcef3242p-128L : inexact-ok
= exp2 tonearest ldbl-96-m68k -0x7.d8p+4L : 0x5.a827999fcef3242p-128L : inexact-ok
= exp2 towardzero ldbl-96-m68k -0x7.d8p+4L : 0x5.a827999fcef3242p-128L : inexact-ok
= exp2 upward ldbl-96-m68k -0x7.d8p+4L : 0x5.a827999fcef32428p-128L : inexact-ok
= exp2 downward ldbl-128 -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9baa54p-128L : inexact-ok
= exp2 tonearest ldbl-128 -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9baa54p-128L : inexact-ok
= exp2 towardzero ldbl-128 -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9baa54p-128L : inexact-ok
= exp2 upward ldbl-128 -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9baa58p-128L : inexact-ok
= exp2 downward ldbl-128ibm -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9baap-128L : inexact-ok
= exp2 tonearest ldbl-128ibm -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9baap-128L : inexact-ok
= exp2 towardzero ldbl-128ibm -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9baap-128L : inexact-ok
= exp2 upward ldbl-128ibm -0x7.d8p+4L : 0x5.a827999fcef32422cbec4d9bacp-128L : inexact-ok
exp2 127 exp2 127
= exp2 downward flt-32 0x7.fp+4f : 0x8p+124f : inexact-ok = exp2 downward flt-32 0x7.fp+4f : 0x8p+124f : inexact-ok
= exp2 tonearest flt-32 0x7.fp+4f : 0x8p+124f : inexact-ok = exp2 tonearest flt-32 0x7.fp+4f : 0x8p+124f : inexact-ok
@ -106766,6 +106866,81 @@ exp2 1000.25
= exp2 tonearest ldbl-128ibm 0x3.e84p+8L : 0x1.306fe0a31b7152de8d5a46305c8p+1000L : inexact-ok = exp2 tonearest ldbl-128ibm 0x3.e84p+8L : 0x1.306fe0a31b7152de8d5a46305c8p+1000L : inexact-ok
= exp2 towardzero ldbl-128ibm 0x3.e84p+8L : 0x1.306fe0a31b7152de8d5a46305c8p+1000L : inexact-ok = exp2 towardzero ldbl-128ibm 0x3.e84p+8L : 0x1.306fe0a31b7152de8d5a46305c8p+1000L : inexact-ok
= exp2 upward ldbl-128ibm 0x3.e84p+8L : 0x1.306fe0a31b7152de8d5a46305dp+1000L : inexact-ok = exp2 upward ldbl-128ibm 0x3.e84p+8L : 0x1.306fe0a31b7152de8d5a46305dp+1000L : inexact-ok
exp2 -1019.5
= exp2 downward flt-32 -0x3.fb8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
= exp2 tonearest flt-32 -0x3.fb8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
= exp2 towardzero flt-32 -0x3.fb8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
= exp2 upward flt-32 -0x3.fb8p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
= exp2 downward dbl-64 -0x3.fb8p+8 : 0x1.6a09e667f3bccp-1020 : inexact-ok
= exp2 tonearest dbl-64 -0x3.fb8p+8 : 0x1.6a09e667f3bcdp-1020 : inexact-ok
= exp2 towardzero dbl-64 -0x3.fb8p+8 : 0x1.6a09e667f3bccp-1020 : inexact-ok
= exp2 upward dbl-64 -0x3.fb8p+8 : 0x1.6a09e667f3bcdp-1020 : inexact-ok
= exp2 downward ldbl-96-intel -0x3.fb8p+8L : 0x1.6a09e667f3bcc908p-1020L : inexact-ok
= exp2 tonearest ldbl-96-intel -0x3.fb8p+8L : 0x1.6a09e667f3bcc908p-1020L : inexact-ok
= exp2 towardzero ldbl-96-intel -0x3.fb8p+8L : 0x1.6a09e667f3bcc908p-1020L : inexact-ok
= exp2 upward ldbl-96-intel -0x3.fb8p+8L : 0x1.6a09e667f3bcc90ap-1020L : inexact-ok
= exp2 downward ldbl-96-m68k -0x3.fb8p+8L : 0x1.6a09e667f3bcc908p-1020L : inexact-ok
= exp2 tonearest ldbl-96-m68k -0x3.fb8p+8L : 0x1.6a09e667f3bcc908p-1020L : inexact-ok
= exp2 towardzero ldbl-96-m68k -0x3.fb8p+8L : 0x1.6a09e667f3bcc908p-1020L : inexact-ok
= exp2 upward ldbl-96-m68k -0x3.fb8p+8L : 0x1.6a09e667f3bcc90ap-1020L : inexact-ok
= exp2 downward ldbl-128 -0x3.fb8p+8L : 0x1.6a09e667f3bcc908b2fb1366ea95p-1020L : inexact-ok
= exp2 tonearest ldbl-128 -0x3.fb8p+8L : 0x1.6a09e667f3bcc908b2fb1366ea95p-1020L : inexact-ok
= exp2 towardzero ldbl-128 -0x3.fb8p+8L : 0x1.6a09e667f3bcc908b2fb1366ea95p-1020L : inexact-ok
= exp2 upward ldbl-128 -0x3.fb8p+8L : 0x1.6a09e667f3bcc908b2fb1366ea96p-1020L : inexact-ok
= exp2 downward ldbl-128ibm -0x3.fb8p+8L : 0x1.6a09e667f3bcc8p-1020L : inexact-ok underflow errno-erange-ok
= exp2 tonearest ldbl-128ibm -0x3.fb8p+8L : 0x1.6a09e667f3bcc8p-1020L : inexact-ok underflow errno-erange-ok
= exp2 towardzero ldbl-128ibm -0x3.fb8p+8L : 0x1.6a09e667f3bcc8p-1020L : inexact-ok underflow errno-erange-ok
= exp2 upward ldbl-128ibm -0x3.fb8p+8L : 0x1.6a09e667f3bcccp-1020L : inexact-ok underflow errno-erange-ok
exp2 -1020.5
= exp2 downward flt-32 -0x3.fc8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
= exp2 tonearest flt-32 -0x3.fc8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
= exp2 towardzero flt-32 -0x3.fc8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
= exp2 upward flt-32 -0x3.fc8p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
= exp2 downward dbl-64 -0x3.fc8p+8 : 0xb.504f333f9de6p-1024 : inexact-ok
= exp2 tonearest dbl-64 -0x3.fc8p+8 : 0xb.504f333f9de68p-1024 : inexact-ok
= exp2 towardzero dbl-64 -0x3.fc8p+8 : 0xb.504f333f9de6p-1024 : inexact-ok
= exp2 upward dbl-64 -0x3.fc8p+8 : 0xb.504f333f9de68p-1024 : inexact-ok
= exp2 downward ldbl-96-intel -0x3.fc8p+8L : 0xb.504f333f9de6484p-1024L : inexact-ok
= exp2 tonearest ldbl-96-intel -0x3.fc8p+8L : 0xb.504f333f9de6484p-1024L : inexact-ok
= exp2 towardzero ldbl-96-intel -0x3.fc8p+8L : 0xb.504f333f9de6484p-1024L : inexact-ok
= exp2 upward ldbl-96-intel -0x3.fc8p+8L : 0xb.504f333f9de6485p-1024L : inexact-ok
= exp2 downward ldbl-96-m68k -0x3.fc8p+8L : 0xb.504f333f9de6484p-1024L : inexact-ok
= exp2 tonearest ldbl-96-m68k -0x3.fc8p+8L : 0xb.504f333f9de6484p-1024L : inexact-ok
= exp2 towardzero ldbl-96-m68k -0x3.fc8p+8L : 0xb.504f333f9de6484p-1024L : inexact-ok
= exp2 upward ldbl-96-m68k -0x3.fc8p+8L : 0xb.504f333f9de6485p-1024L : inexact-ok
= exp2 downward ldbl-128 -0x3.fc8p+8L : 0xb.504f333f9de6484597d89b3754a8p-1024L : inexact-ok
= exp2 tonearest ldbl-128 -0x3.fc8p+8L : 0xb.504f333f9de6484597d89b3754a8p-1024L : inexact-ok
= exp2 towardzero ldbl-128 -0x3.fc8p+8L : 0xb.504f333f9de6484597d89b3754a8p-1024L : inexact-ok
= exp2 upward ldbl-128 -0x3.fc8p+8L : 0xb.504f333f9de6484597d89b3754bp-1024L : inexact-ok
= exp2 downward ldbl-128ibm -0x3.fc8p+8L : 0xb.504f333f9de64p-1024L : inexact-ok underflow errno-erange-ok
= exp2 tonearest ldbl-128ibm -0x3.fc8p+8L : 0xb.504f333f9de64p-1024L : inexact-ok underflow errno-erange-ok
= exp2 towardzero ldbl-128ibm -0x3.fc8p+8L : 0xb.504f333f9de64p-1024L : inexact-ok underflow errno-erange-ok
= exp2 upward ldbl-128ibm -0x3.fc8p+8L : 0xb.504f333f9de68p-1024L : inexact-ok underflow errno-erange-ok
exp2 -1021.5
= exp2 downward flt-32 -0x3.fd8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
= exp2 tonearest flt-32 -0x3.fd8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
= exp2 towardzero flt-32 -0x3.fd8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
= exp2 upward flt-32 -0x3.fd8p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
= exp2 downward dbl-64 -0x3.fd8p+8 : 0x5.a827999fcef3p-1024 : inexact-ok
= exp2 tonearest dbl-64 -0x3.fd8p+8 : 0x5.a827999fcef34p-1024 : inexact-ok
= exp2 towardzero dbl-64 -0x3.fd8p+8 : 0x5.a827999fcef3p-1024 : inexact-ok
= exp2 upward dbl-64 -0x3.fd8p+8 : 0x5.a827999fcef34p-1024 : inexact-ok
= exp2 downward ldbl-96-intel -0x3.fd8p+8L : 0x5.a827999fcef3242p-1024L : inexact-ok
= exp2 tonearest ldbl-96-intel -0x3.fd8p+8L : 0x5.a827999fcef3242p-1024L : inexact-ok
= exp2 towardzero ldbl-96-intel -0x3.fd8p+8L : 0x5.a827999fcef3242p-1024L : inexact-ok
= exp2 upward ldbl-96-intel -0x3.fd8p+8L : 0x5.a827999fcef32428p-1024L : inexact-ok
= exp2 downward ldbl-96-m68k -0x3.fd8p+8L : 0x5.a827999fcef3242p-1024L : inexact-ok
= exp2 tonearest ldbl-96-m68k -0x3.fd8p+8L : 0x5.a827999fcef3242p-1024L : inexact-ok
= exp2 towardzero ldbl-96-m68k -0x3.fd8p+8L : 0x5.a827999fcef3242p-1024L : inexact-ok
= exp2 upward ldbl-96-m68k -0x3.fd8p+8L : 0x5.a827999fcef32428p-1024L : inexact-ok
= exp2 downward ldbl-128 -0x3.fd8p+8L : 0x5.a827999fcef32422cbec4d9baa54p-1024L : inexact-ok
= exp2 tonearest ldbl-128 -0x3.fd8p+8L : 0x5.a827999fcef32422cbec4d9baa54p-1024L : inexact-ok
= exp2 towardzero ldbl-128 -0x3.fd8p+8L : 0x5.a827999fcef32422cbec4d9baa54p-1024L : inexact-ok
= exp2 upward ldbl-128 -0x3.fd8p+8L : 0x5.a827999fcef32422cbec4d9baa58p-1024L : inexact-ok
= exp2 downward ldbl-128ibm -0x3.fd8p+8L : 0x5.a827999fcef3p-1024L : inexact-ok underflow errno-erange-ok
= exp2 tonearest ldbl-128ibm -0x3.fd8p+8L : 0x5.a827999fcef34p-1024L : inexact-ok underflow errno-erange-ok
= exp2 towardzero ldbl-128ibm -0x3.fd8p+8L : 0x5.a827999fcef3p-1024L : inexact-ok underflow errno-erange-ok
= exp2 upward ldbl-128ibm -0x3.fd8p+8L : 0x5.a827999fcef34p-1024L : inexact-ok underflow errno-erange-ok
exp2 1023 exp2 1023
= exp2 downward flt-32 0x3.ffp+8f : 0xf.fffffp+124f : inexact-ok overflow errno-erange-ok = exp2 downward flt-32 0x3.ffp+8f : 0xf.fffffp+124f : inexact-ok overflow errno-erange-ok
= exp2 tonearest flt-32 0x3.ffp+8f : plus_infty : inexact-ok overflow errno-erange = exp2 tonearest flt-32 0x3.ffp+8f : plus_infty : inexact-ok overflow errno-erange

View File

@ -96,7 +96,9 @@ __ieee754_exp2 (double x)
/* 3. Compute ex2 = 2^(t/512+e+ex). */ /* 3. Compute ex2 = 2^(t/512+e+ex). */
ex2_u.d = exp2_accuratetable[tval & 511]; ex2_u.d = exp2_accuratetable[tval & 511];
tval >>= 9; tval >>= 9;
unsafe = abs (tval) >= -DBL_MIN_EXP - 1; /* x2 is an integer multiple of 2^-54; avoid intermediate
underflow from the calculation of x22 * x. */
unsafe = abs (tval) >= -DBL_MIN_EXP - 56;
ex2_u.ieee.exponent += tval >> unsafe; ex2_u.ieee.exponent += tval >> unsafe;
scale_u.d = 1.0; scale_u.d = 1.0;
scale_u.ieee.exponent += tval - (tval >> unsafe); scale_u.ieee.exponent += tval - (tval >> unsafe);

View File

@ -89,7 +89,9 @@ __ieee754_exp2f (float x)
/* 3. Compute ex2 = 2^(t/255+e+ex). */ /* 3. Compute ex2 = 2^(t/255+e+ex). */
ex2_u.f = __exp2f_atable[tval & 255]; ex2_u.f = __exp2f_atable[tval & 255];
tval >>= 8; 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; ex2_u.ieee.exponent += tval >> unsafe;
scale_u.f = 1.0; scale_u.f = 1.0;
scale_u.ieee.exponent += tval - (tval >> unsafe); scale_u.ieee.exponent += tval - (tval >> unsafe);