summaryrefslogtreecommitdiff
path: root/math/s_ctanhf.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/s_ctanhf.c')
-rw-r--r--math/s_ctanhf.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/math/s_ctanhf.c b/math/s_ctanhf.c
index 14e1371ef5..ffe95f635e 100644
--- a/math/s_ctanhf.c
+++ b/math/s_ctanhf.c
@@ -1,5 +1,5 @@
/* Complex hyperbole tangent for float.
- 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 @@ __ctanhf (__complex__ float x)
if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
{
- if (__isinf_nsf (__real__ x))
+ if (isinf (__real__ x))
{
__real__ res = __copysignf (1.0, __real__ x);
- __imag__ res = __copysignf (0.0, __imag__ x);
+ if (isfinite (__imag__ x) && fabsf (__imag__ x) > 1.0f)
+ {
+ float sinix, cosix;
+ __sincosf (__imag__ x, &sinix, &cosix);
+ __imag__ res = __copysignf (0.0f, sinix * cosix);
+ }
+ else
+ __imag__ res = __copysignf (0.0, __imag__ x);
}
else if (__imag__ x == 0.0)
{
@@ -44,7 +51,7 @@ __ctanhf (__complex__ float x)
__real__ res = __nanf ("");
__imag__ res = __nanf ("");
- if (__isinf_nsf (__imag__ x))
+ if (isinf (__imag__ x))
feraiseexcept (FE_INVALID);
}
}
@@ -110,6 +117,7 @@ __ctanhf (__complex__ float x)
__real__ res = sinhrx * coshrx / den;
__imag__ res = sinix * cosix / den;
}
+ math_check_force_underflow_complex (res);
}
return res;