aboutsummaryrefslogtreecommitdiff
path: root/math/libm-test.inc
diff options
context:
space:
mode:
Diffstat (limited to 'math/libm-test.inc')
-rw-r--r--math/libm-test.inc23
1 files changed, 16 insertions, 7 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 2809d57..94d60bf 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -3802,13 +3802,22 @@ ilogb_test (void)
TEST_f_i (ilogb, 1024, 10);
TEST_f_i (ilogb, -2000, 10);
- /* XXX We have a problem here: the standard does not tell us whether
- exceptions are allowed/required. ignore them for now. */
-
- TEST_f_i (ilogb, 0.0, FP_ILOGB0, EXCEPTIONS_OK);
- TEST_f_i (ilogb, nan_value, FP_ILOGBNAN, EXCEPTIONS_OK);
- TEST_f_i (ilogb, plus_infty, INT_MAX, EXCEPTIONS_OK);
- TEST_f_i (ilogb, minus_infty, INT_MAX, EXCEPTIONS_OK);
+ /* ilogb (0.0) == FP_ILOGB0 plus invalid exception */
+ errno = 0;
+ TEST_f_i (ilogb, 0.0, FP_ILOGB0, INVALID_EXCEPTION);
+ check_int ("errno for ilogb(0.0) unchanged", errno, EDOM, 0, 0, 0);
+ /* ilogb (NaN) == FP_ILOGBNAN plus invalid exception */
+ errno = 0;
+ TEST_f_i (ilogb, nan_value, FP_ILOGBNAN, INVALID_EXCEPTION);
+ check_int ("errno for ilogb(NaN) unchanged", errno, EDOM, 0, 0, 0);
+ /* ilogb (inf) == INT_MAX plus invalid exception */
+ errno = 0;
+ TEST_f_i (ilogb, plus_infty, INT_MAX, INVALID_EXCEPTION);
+ check_int ("errno for ilogb(Inf) unchanged", errno, EDOM, 0, 0, 0);
+ /* ilogb (-inf) == INT_MAX plus invalid exception */
+ errno = 0;
+ TEST_f_i (ilogb, minus_infty, INT_MAX, INVALID_EXCEPTION);
+ check_int ("errno for ilogb(-Inf) unchanged", errno, EDOM, 0, 0, 0);
END (ilogb);
}