diff options
author | Joseph Myers <joseph@codesourcery.com> | 2012-11-07 13:03:31 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2012-11-07 13:03:31 +0000 |
commit | 60e235ee2ae834bb9f7a884f1b192304b9fdcf33 (patch) | |
tree | 4053809680e9b6def9eab8272fc70ac6c6edb16c /math/libm-test.inc | |
parent | 0ab234b7db4991121eb572bf5c4971bfeb2d49a2 (diff) | |
download | glibc-60e235ee2ae834bb9f7a884f1b192304b9fdcf33.tar.gz glibc-60e235ee2ae834bb9f7a884f1b192304b9fdcf33.tar.xz glibc-60e235ee2ae834bb9f7a884f1b192304b9fdcf33.zip |
Fix spurious underflows from pow with results close to 1 (bug 14811).
Diffstat (limited to 'math/libm-test.inc')
-rw-r--r-- | math/libm-test.inc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc index a52ce6aa2d..74488e7b6a 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -7743,10 +7743,12 @@ pow_test (void) TEST_ff_f (pow, plus_infty, 1e-7L, plus_infty); TEST_ff_f (pow, plus_infty, 1, plus_infty); TEST_ff_f (pow, plus_infty, 1e7L, plus_infty); + TEST_ff_f (pow, plus_infty, min_subnorm_value, plus_infty); TEST_ff_f (pow, plus_infty, -1e-7L, 0); TEST_ff_f (pow, plus_infty, -1, 0); TEST_ff_f (pow, plus_infty, -1e7L, 0); + TEST_ff_f (pow, plus_infty, -min_subnorm_value, 0); TEST_ff_f (pow, minus_infty, 1, minus_infty); TEST_ff_f (pow, minus_infty, 11, minus_infty); @@ -7759,6 +7761,7 @@ pow_test (void) TEST_ff_f (pow, minus_infty, 1.1L, plus_infty); TEST_ff_f (pow, minus_infty, 11.1L, plus_infty); TEST_ff_f (pow, minus_infty, 1001.1L, plus_infty); + TEST_ff_f (pow, minus_infty, min_subnorm_value, plus_infty); TEST_ff_f (pow, minus_infty, -1, minus_zero); TEST_ff_f (pow, minus_infty, -11, minus_zero); @@ -7771,6 +7774,7 @@ pow_test (void) TEST_ff_f (pow, minus_infty, -1.1L, 0); TEST_ff_f (pow, minus_infty, -11.1L, 0); TEST_ff_f (pow, minus_infty, -1001.1L, 0); + TEST_ff_f (pow, minus_infty, -min_subnorm_value, 0); #endif TEST_ff_f (pow, nan_value, nan_value, nan_value); @@ -7793,6 +7797,8 @@ pow_test (void) TEST_ff_f (pow, nan_value, minus_infty, nan_value); TEST_ff_f (pow, nan_value, 2.5, nan_value); TEST_ff_f (pow, nan_value, -2.5, nan_value); + TEST_ff_f (pow, nan_value, min_subnorm_value, nan_value); + TEST_ff_f (pow, nan_value, -min_subnorm_value, nan_value); TEST_ff_f (pow, 1, plus_infty, 1); TEST_ff_f (pow, -1, plus_infty, 1); @@ -7806,6 +7812,8 @@ pow_test (void) TEST_ff_f (pow, 1, 0x1p63L, 1); TEST_ff_f (pow, 1, 0x1p64L, 1); TEST_ff_f (pow, 1, 0x1p72L, 1); + TEST_ff_f (pow, 1, min_subnorm_value, 1); + TEST_ff_f (pow, 1, -min_subnorm_value, 1); /* pow (x, +-0) == 1. */ TEST_ff_f (pow, plus_infty, 0, 1); @@ -7825,6 +7833,10 @@ pow_test (void) TEST_ff_f (pow, -0.1L, -1.1L, nan_value, INVALID_EXCEPTION); TEST_ff_f (pow, -10.1L, 1.1L, nan_value, INVALID_EXCEPTION); TEST_ff_f (pow, -10.1L, -1.1L, nan_value, INVALID_EXCEPTION); + TEST_ff_f (pow, -1.01L, min_subnorm_value, nan_value, INVALID_EXCEPTION); + TEST_ff_f (pow, -1.01L, -min_subnorm_value, nan_value, INVALID_EXCEPTION); + TEST_ff_f (pow, -1.0L, min_subnorm_value, nan_value, INVALID_EXCEPTION); + TEST_ff_f (pow, -1.0L, -min_subnorm_value, nan_value, INVALID_EXCEPTION); errno = 0; TEST_ff_f (pow, 0, -1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); @@ -7910,6 +7922,9 @@ pow_test (void) TEST_ff_f (pow, 0, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); check_int ("errno for pow(0,-num) == ERANGE", errno, ERANGE, 0, 0, 0); errno = 0; + TEST_ff_f (pow, 0, -min_subnorm_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); + check_int ("errno for pow(0,-num) == ERANGE", errno, ERANGE, 0, 0, 0); + errno = 0; TEST_ff_f (pow, 0, -0x1p24, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); check_int ("errno for pow(0,-num) == ERANGE", errno, ERANGE, 0, 0, 0); errno = 0; @@ -7925,6 +7940,9 @@ pow_test (void) TEST_ff_f (pow, minus_zero, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); check_int ("errno for pow(-0,-num) == ERANGE", errno, ERANGE, 0, 0, 0); errno = 0; + TEST_ff_f (pow, minus_zero, -min_subnorm_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); + check_int ("errno for pow(-0,-num) == ERANGE", errno, ERANGE, 0, 0, 0); + errno = 0; TEST_ff_f (pow, minus_zero, -0x1p24, plus_infty, DIVIDE_BY_ZERO_EXCEPTION); check_int ("errno for pow(-0,-num) == ERANGE", errno, ERANGE, 0, 0, 0); errno = 0; @@ -8114,12 +8132,14 @@ pow_test (void) TEST_ff_f (pow, 0.0, 0x1p24, 0.0); TEST_ff_f (pow, 0.0, 0x1p127, 0.0); TEST_ff_f (pow, 0.0, max_value, 0.0); + TEST_ff_f (pow, 0.0, min_subnorm_value, 0.0); /* pow (-0, y) == +0 for y > 0 and not an odd integer. */ TEST_ff_f (pow, minus_zero, 4, 0.0); TEST_ff_f (pow, minus_zero, 0x1p24, 0.0); TEST_ff_f (pow, minus_zero, 0x1p127, 0.0); TEST_ff_f (pow, minus_zero, max_value, 0.0); + TEST_ff_f (pow, minus_zero, min_subnorm_value, 0.0); TEST_ff_f (pow, 16, 0.25L, 2); TEST_ff_f (pow, 0x1p64L, 0.125L, 256); @@ -8407,6 +8427,15 @@ pow_test (void) TEST_ff_f (pow, 0x1.0000000000001p0L, -0x1.23456789abcdfp61L, 1.0118762747828234466621210689458255908670e-253L); #endif + TEST_ff_f (pow, min_subnorm_value, min_subnorm_value, 1.0L); + TEST_ff_f (pow, min_subnorm_value, -min_subnorm_value, 1.0L); + TEST_ff_f (pow, max_value, min_subnorm_value, 1.0L); + TEST_ff_f (pow, max_value, -min_subnorm_value, 1.0L); + TEST_ff_f (pow, 0.99L, min_subnorm_value, 1.0L); + TEST_ff_f (pow, 0.99L, -min_subnorm_value, 1.0L); + TEST_ff_f (pow, 1.01L, min_subnorm_value, 1.0L); + TEST_ff_f (pow, 1.01L, -min_subnorm_value, 1.0L); + TEST_ff_f (pow, 2.0L, -100000.0L, plus_zero, UNDERFLOW_EXCEPTION); END (pow); |