diff options
Diffstat (limited to 'math/s_ctanh.c')
-rw-r--r-- | math/s_ctanh.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/math/s_ctanh.c b/math/s_ctanh.c index 76a0501a73..a41cd1a0a6 100644 --- a/math/s_ctanh.c +++ b/math/s_ctanh.c @@ -33,7 +33,14 @@ __ctanh (__complex__ double x) if (__isinf_ns (__real__ x)) { __real__ res = __copysign (1.0, __real__ x); - __imag__ res = __copysign (0.0, __imag__ x); + if (isfinite (__imag__ x) && fabs (__imag__ x) > 1.0) + { + double sinix, cosix; + __sincos (__imag__ x, &sinix, &cosix); + __imag__ res = __copysign (0.0, sinix * cosix); + } + else + __imag__ res = __copysign (0.0, __imag__ x); } else if (__imag__ x == 0.0) { |