diff options
author | Joseph Myers <joseph@codesourcery.com> | 2017-12-07 16:21:00 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2017-12-07 16:21:00 +0000 |
commit | d15e83c5f5231d971472b5ffc9219d54056ca0f1 (patch) | |
tree | bbc07214991185682fd6fe1dada1907e3fe6608b /math/libm-test-ctanh.inc | |
parent | d89756ebe1905c1989179c2f1c2b10ef2fb3354e (diff) | |
download | glibc-d15e83c5f5231d971472b5ffc9219d54056ca0f1.tar.gz glibc-d15e83c5f5231d971472b5ffc9219d54056ca0f1.tar.xz glibc-d15e83c5f5231d971472b5ffc9219d54056ca0f1.zip |
Fix ctanh (0 + i NaN), ctanh (0 + i Inf) (bug 22568, DR#471).
As per C11 DR#471, ctanh (0 + i NaN) and ctanh (0 + i Inf) should return 0 + i NaN (with "invalid" exception in the second case but not the first), not NaN + i NaN. This has corresponding implications for ctan since its special cases are defined by ctan (z) = -i ctanh (iz). This patch implements these cases for ctanh and ctan, updating tests accordingly. Tested for x86_64. [BZ #22568] * math/s_ctan_template.c (M_DECL_FUNC (__ctan)): Set imaginary part of result to imaginary part of argument if it is zero and the real part of the argument is not finite. * math/s_ctanh_template.c (M_DECL_FUNC (__ctanh)): Set real part of result to real part of argument if it is zero and the imaginary part of the argument is not finite.
Diffstat (limited to 'math/libm-test-ctanh.inc')
-rw-r--r-- | math/libm-test-ctanh.inc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/math/libm-test-ctanh.inc b/math/libm-test-ctanh.inc index 6ddeb0d361..8a8148248a 100644 --- a/math/libm-test-ctanh.inc +++ b/math/libm-test-ctanh.inc @@ -89,13 +89,13 @@ static const struct test_c_c_data ctanh_test_data[] = TEST_c_c (ctanh, minus_infty, -0x1.2p16383L, -1.0, 0.0), #endif - TEST_c_c (ctanh, 0, plus_infty, qnan_value, qnan_value, INVALID_EXCEPTION), + TEST_c_c (ctanh, 0, plus_infty, 0, qnan_value, INVALID_EXCEPTION), TEST_c_c (ctanh, 2, plus_infty, qnan_value, qnan_value, INVALID_EXCEPTION), - TEST_c_c (ctanh, 0, minus_infty, qnan_value, qnan_value, INVALID_EXCEPTION), + TEST_c_c (ctanh, 0, minus_infty, 0, qnan_value, INVALID_EXCEPTION), TEST_c_c (ctanh, 2, minus_infty, qnan_value, qnan_value, INVALID_EXCEPTION), - TEST_c_c (ctanh, minus_zero, plus_infty, qnan_value, qnan_value, INVALID_EXCEPTION), + TEST_c_c (ctanh, minus_zero, plus_infty, minus_zero, qnan_value, INVALID_EXCEPTION), TEST_c_c (ctanh, -2, plus_infty, qnan_value, qnan_value, INVALID_EXCEPTION), - TEST_c_c (ctanh, minus_zero, minus_infty, qnan_value, qnan_value, INVALID_EXCEPTION), + TEST_c_c (ctanh, minus_zero, minus_infty, minus_zero, qnan_value, INVALID_EXCEPTION), TEST_c_c (ctanh, -2, minus_infty, qnan_value, qnan_value, INVALID_EXCEPTION), TEST_c_c (ctanh, plus_infty, qnan_value, 1.0, 0.0, IGNORE_ZERO_INF_SIGN), @@ -111,9 +111,9 @@ static const struct test_c_c_data ctanh_test_data[] = TEST_c_c (ctanh, qnan_value, 0.5, qnan_value, qnan_value, INVALID_EXCEPTION_OK), TEST_c_c (ctanh, qnan_value, -4.5, qnan_value, qnan_value, INVALID_EXCEPTION_OK), - TEST_c_c (ctanh, 0, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK), + TEST_c_c (ctanh, 0, qnan_value, 0, qnan_value), TEST_c_c (ctanh, 5, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK), - TEST_c_c (ctanh, minus_zero, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK), + TEST_c_c (ctanh, minus_zero, qnan_value, minus_zero, qnan_value), TEST_c_c (ctanh, -0.25, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK), TEST_c_c (ctanh, qnan_value, qnan_value, qnan_value, qnan_value), |