diff options
Diffstat (limited to 'math')
-rw-r--r-- | math/e_scalb.c | 2 | ||||
-rw-r--r-- | math/e_scalbf.c | 2 | ||||
-rw-r--r-- | math/e_scalbl.c | 2 | ||||
-rw-r--r-- | math/libm-test.inc | 17 |
4 files changed, 20 insertions, 3 deletions
diff --git a/math/e_scalb.c b/math/e_scalb.c index bddedfa032..146d49e1c3 100644 --- a/math/e_scalb.c +++ b/math/e_scalb.c @@ -50,7 +50,7 @@ __ieee754_scalb (double x, double fn) return x; return x / -fn; } - if (__glibc_unlikely ((double) (int) fn != fn)) + if (__glibc_unlikely (fabs (fn) >= 0x1p31 || (double) (int) fn != fn)) return invalid_fn (x, fn); return __scalbn (x, (int) fn); diff --git a/math/e_scalbf.c b/math/e_scalbf.c index 319752c993..3f2e853353 100644 --- a/math/e_scalbf.c +++ b/math/e_scalbf.c @@ -50,7 +50,7 @@ __ieee754_scalbf (float x, float fn) return x; return x / -fn; } - if (__glibc_unlikely ((float) (int) fn != fn)) + if (__glibc_unlikely (fabsf (fn) >= 0x1p31f || (float) (int) fn != fn)) return invalid_fn (x, fn); return __scalbnf (x, (int) fn); diff --git a/math/e_scalbl.c b/math/e_scalbl.c index 5815a0d67b..739db7a188 100644 --- a/math/e_scalbl.c +++ b/math/e_scalbl.c @@ -50,7 +50,7 @@ __ieee754_scalbl (long double x, long double fn) return x; return x / -fn; } - if (__glibc_unlikely ((long double) (int) fn != fn)) + if (__glibc_unlikely (fabsl (fn) >= 0x1p31L || (long double) (int) fn != fn)) return invalid_fn (x, fn); return __scalbnl (x, (int) fn); diff --git a/math/libm-test.inc b/math/libm-test.inc index cefcb9682a..0eff34a0ca 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -9134,6 +9134,23 @@ static const struct test_ff_f_data scalb_test_data[] = TEST_ff_f (scalb, plus_infty, qnan_value, qnan_value, NO_INEXACT_EXCEPTION), TEST_ff_f (scalb, qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION), + TEST_ff_f (scalb, max_value, max_value, plus_oflow, OVERFLOW_EXCEPTION), + TEST_ff_f (scalb, max_value, -max_value, plus_uflow, UNDERFLOW_EXCEPTION), + TEST_ff_f (scalb, 1, max_value, plus_oflow, OVERFLOW_EXCEPTION), + TEST_ff_f (scalb, 1, -max_value, plus_uflow, UNDERFLOW_EXCEPTION), + TEST_ff_f (scalb, min_value, max_value, plus_oflow, OVERFLOW_EXCEPTION), + TEST_ff_f (scalb, min_value, -max_value, plus_uflow, UNDERFLOW_EXCEPTION), + TEST_ff_f (scalb, min_subnorm_value, max_value, plus_oflow, OVERFLOW_EXCEPTION), + TEST_ff_f (scalb, min_subnorm_value, -max_value, plus_uflow, UNDERFLOW_EXCEPTION), + TEST_ff_f (scalb, -max_value, max_value, minus_oflow, OVERFLOW_EXCEPTION), + TEST_ff_f (scalb, -max_value, -max_value, minus_uflow, UNDERFLOW_EXCEPTION), + TEST_ff_f (scalb, -1, max_value, minus_oflow, OVERFLOW_EXCEPTION), + TEST_ff_f (scalb, -1, -max_value, minus_uflow, UNDERFLOW_EXCEPTION), + TEST_ff_f (scalb, -min_value, max_value, minus_oflow, OVERFLOW_EXCEPTION), + TEST_ff_f (scalb, -min_value, -max_value, minus_uflow, UNDERFLOW_EXCEPTION), + TEST_ff_f (scalb, -min_subnorm_value, max_value, minus_oflow, OVERFLOW_EXCEPTION), + TEST_ff_f (scalb, -min_subnorm_value, -max_value, minus_uflow, UNDERFLOW_EXCEPTION), + TEST_ff_f (scalb, 0.8L, 4, 12.8L), TEST_ff_f (scalb, -0.854375L, 5, -27.34L), }; |