about summary refs log tree commit diff
path: root/math/s_ctanhl.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/s_ctanhl.c')
-rw-r--r--math/s_ctanhl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/math/s_ctanhl.c b/math/s_ctanhl.c
index 9c15bb3a4a..2fc54a85d0 100644
--- a/math/s_ctanhl.c
+++ b/math/s_ctanhl.c
@@ -40,7 +40,14 @@ __ctanhl (__complex__ long double x)
       if (__isinf_nsl (__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)
 	{