about summary refs log tree commit diff
path: root/sysdeps/libm-ieee754/s_csinhl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754/s_csinhl.c')
-rw-r--r--sysdeps/libm-ieee754/s_csinhl.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sysdeps/libm-ieee754/s_csinhl.c b/sysdeps/libm-ieee754/s_csinhl.c
index 4bb9e63680..694b39d670 100644
--- a/sysdeps/libm-ieee754/s_csinhl.c
+++ b/sysdeps/libm-ieee754/s_csinhl.c
@@ -41,12 +41,13 @@ __csinhl (__complex__ long double x)
 	{
 	  /* Imaginary part is finite.  */
 	  long double sinh_val = __ieee754_sinhl (__real__ x);
+	  long double cosh_val = __ieee754_coshl (__real__ x);
 	  long double sinix, cosix;
 
 	  __sincosl (__imag__ x, &sinix, &cosix);
 
 	  __real__ retval = sinh_val * cosix;
-	  __imag__ retval = sinh_val * sinix;
+	  __imag__ retval = cosh_val * sinix;
 
 	  if (negate)
 	    __real__ retval = -__real__ retval;
@@ -58,11 +59,20 @@ __csinhl (__complex__ long double x)
 	      /* Real part is 0.0.  */
 	      __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
 	      __imag__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+	      if (icls == FP_INFINITE)
+		feraiseexcept (FE_INVALID);
+#endif
 	    }
 	  else
 	    {
 	      __real__ retval = __nanl ("");
 	      __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+	      feraiseexcept (FE_INVALID);
+#endif
 	    }
 	}
     }
@@ -93,6 +103,11 @@ __csinhl (__complex__ long double x)
 	  /* The addition raises the invalid exception.  */
 	  __real__ retval = HUGE_VALL;
 	  __imag__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+	  if (icls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
 	}
     }
   else