summaryrefslogtreecommitdiff
path: root/math/s_ctan.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/s_ctan.c')
-rw-r--r--math/s_ctan.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/math/s_ctan.c b/math/s_ctan.c
index eaf31fa647..8e8bf2ee2b 100644
--- a/math/s_ctan.c
+++ b/math/s_ctan.c
@@ -1,5 +1,5 @@
/* Complex tangent function 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,9 +30,16 @@ __ctan (__complex__ double x)
if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
{
- if (__isinf_ns (__imag__ x))
+ if (isinf (__imag__ x))
{
- __real__ res = __copysign (0.0, __real__ x);
+ if (isfinite (__real__ x) && fabs (__real__ x) > 1.0)
+ {
+ double sinrx, cosrx;
+ __sincos (__real__ x, &sinrx, &cosrx);
+ __real__ res = __copysign (0.0, sinrx * cosrx);
+ }
+ else
+ __real__ res = __copysign (0.0, __real__ x);
__imag__ res = __copysign (1.0, __imag__ x);
}
else if (__real__ x == 0.0)
@@ -44,7 +51,7 @@ __ctan (__complex__ double x)
__real__ res = __nan ("");
__imag__ res = __nan ("");
- if (__isinf_ns (__real__ x))
+ if (isinf (__real__ x))
feraiseexcept (FE_INVALID);
}
}
@@ -110,6 +117,7 @@ __ctan (__complex__ double x)
__real__ res = sinrx * cosrx / den;
__imag__ res = sinhix * coshix / den;
}
+ math_check_force_underflow_complex (res);
}
return res;