summaryrefslogtreecommitdiff
path: root/math/s_ctanhl.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/s_ctanhl.c')
-rw-r--r--math/s_ctanhl.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/math/s_ctanhl.c b/math/s_ctanhl.c
index 6b9dfc5bb2..3404d0687e 100644
--- a/math/s_ctanhl.c
+++ b/math/s_ctanhl.c
@@ -1,5 +1,5 @@
/* Complex hyperbole tangent for long 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.
@@ -37,10 +37,17 @@ __ctanhl (__complex__ long double x)
if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
{
- if (__isinf_nsl (__real__ x))
+ if (isinf (__real__ x))
{
__real__ res = __copysignl (1.0, __real__ x);
- __imag__ res = __copysignl (0.0, __imag__ x);
+ if (isfinite (__imag__ x) && fabsl (__imag__ x) > 1.0L)
+ {
+ long double sinix, cosix;
+ __sincosl (__imag__ x, &sinix, &cosix);
+ __imag__ res = __copysignl (0.0L, sinix * cosix);
+ }
+ else
+ __imag__ res = __copysignl (0.0, __imag__ x);
}
else if (__imag__ x == 0.0)
{
@@ -51,7 +58,7 @@ __ctanhl (__complex__ long double x)
__real__ res = __nanl ("");
__imag__ res = __nanl ("");
- if (__isinf_nsl (__imag__ x))
+ if (isinf (__imag__ x))
feraiseexcept (FE_INVALID);
}
}
@@ -117,6 +124,7 @@ __ctanhl (__complex__ long double x)
__real__ res = sinhrx * coshrx / den;
__imag__ res = sinix * cosix / den;
}
+ math_check_force_underflow_complex (res);
}
return res;