+2017-12-07 Joseph Myers <joseph@codesourcery.com>
+
+ [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.
+
2017-12-07 Mike FABIAN <mfabian@redhat.com>
[BZ #22524]
TEST_c_c (ctan, -0x1.2p16383L, minus_infty, 0.0, -1.0),
#endif
- TEST_c_c (ctan, plus_infty, 0, qnan_value, qnan_value, INVALID_EXCEPTION),
+ TEST_c_c (ctan, plus_infty, 0, qnan_value, 0, INVALID_EXCEPTION),
TEST_c_c (ctan, plus_infty, 2, qnan_value, qnan_value, INVALID_EXCEPTION),
- TEST_c_c (ctan, minus_infty, 0, qnan_value, qnan_value, INVALID_EXCEPTION),
+ TEST_c_c (ctan, minus_infty, 0, qnan_value, 0, INVALID_EXCEPTION),
TEST_c_c (ctan, minus_infty, 2, qnan_value, qnan_value, INVALID_EXCEPTION),
- TEST_c_c (ctan, plus_infty, minus_zero, qnan_value, qnan_value, INVALID_EXCEPTION),
+ TEST_c_c (ctan, plus_infty, minus_zero, qnan_value, minus_zero, INVALID_EXCEPTION),
TEST_c_c (ctan, plus_infty, -2, qnan_value, qnan_value, INVALID_EXCEPTION),
- TEST_c_c (ctan, minus_infty, minus_zero, qnan_value, qnan_value, INVALID_EXCEPTION),
+ TEST_c_c (ctan, minus_infty, minus_zero, qnan_value, minus_zero, INVALID_EXCEPTION),
TEST_c_c (ctan, minus_infty, -2, qnan_value, qnan_value, INVALID_EXCEPTION),
TEST_c_c (ctan, qnan_value, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN),
TEST_c_c (ctan, 0.5, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
TEST_c_c (ctan, -4.5, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
- TEST_c_c (ctan, qnan_value, 0, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
+ TEST_c_c (ctan, qnan_value, 0, qnan_value, 0),
TEST_c_c (ctan, qnan_value, 5, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
- TEST_c_c (ctan, qnan_value, minus_zero, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
+ TEST_c_c (ctan, qnan_value, minus_zero, qnan_value, minus_zero),
TEST_c_c (ctan, qnan_value, -0.25, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
TEST_c_c (ctan, qnan_value, qnan_value, qnan_value, qnan_value),
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),
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),
else
{
__real__ res = M_NAN;
- __imag__ res = M_NAN;
+ if (__imag__ x == 0)
+ __imag__ res = __imag__ x;
+ else
+ __imag__ res = M_NAN;
if (isinf (__real__ x))
feraiseexcept (FE_INVALID);
}
else
{
- __real__ res = M_NAN;
+ if (__real__ x == 0)
+ __real__ res = __real__ x;
+ else
+ __real__ res = M_NAN;
__imag__ res = M_NAN;
if (isinf (__imag__ x))