summaryrefslogtreecommitdiff
path: root/math/s_ctanh.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/s_ctanh.c')
-rw-r--r--math/s_ctanh.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/math/s_ctanh.c b/math/s_ctanh.c
index 1347d07834..2d18875c70 100644
--- a/math/s_ctanh.c
+++ b/math/s_ctanh.c
@@ -1,5 +1,5 @@
/* Complex hyperbole tangent for double.
- Copyright (C) 1997-2015 Free Software Foundation, Inc.
+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -30,10 +30,17 @@ __ctanh (__complex__ double x)
if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
{
- if (__isinf_ns (__real__ x))
+ if (isinf (__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)
{
@@ -44,7 +51,7 @@ __ctanh (__complex__ double x)
__real__ res = __nan ("");
__imag__ res = __nan ("");
- if (__isinf_ns (__imag__ x))
+ if (isinf (__imag__ x))
feraiseexcept (FE_INVALID);
}
}
@@ -110,6 +117,7 @@ __ctanh (__complex__ double x)
__real__ res = sinhrx * coshrx / den;
__imag__ res = sinix * cosix / den;
}
+ math_check_force_underflow_complex (res);
}
return res;