diff options
Diffstat (limited to 'math')
-rw-r--r-- | math/libm-test.inc | 4 | ||||
-rw-r--r-- | math/s_nexttowardf.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc index f627296..ac1fe85 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -8536,6 +8536,10 @@ static const struct test_ff_f_data_nexttoward nexttoward_test_data[] = TEST_ff_f (nexttoward, 1.1L, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), TEST_ff_f (nexttoward, qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), + /* Bug 6799: errno setting may be missing. */ + TEST_ff_f (nexttoward, max_value, plus_infty, plus_infty, INEXACT_EXCEPTION|OVERFLOW_EXCEPTION), + TEST_ff_f (nexttoward, -max_value, minus_infty, minus_infty, INEXACT_EXCEPTION|OVERFLOW_EXCEPTION), + #ifdef TEST_FLOAT TEST_ff_f (nexttoward, 1.0, 1.1L, 0x1.000002p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), TEST_ff_f (nexttoward, 1.0, LDBL_MAX, 0x1.000002p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), diff --git a/math/s_nexttowardf.c b/math/s_nexttowardf.c index 06e1bb1..06350d4 100644 --- a/math/s_nexttowardf.c +++ b/math/s_nexttowardf.c @@ -59,8 +59,8 @@ float __nexttowardf(float x, long double y) } hy = hx&0x7f800000; if(hy>=0x7f800000) { - x = math_narrow_eval (x+x); /* overflow */ - return x; + float u = x+x; /* overflow */ + math_force_eval (u); } if(hy<0x00800000) { float u = x*x; /* underflow */ |