diff options
Diffstat (limited to 'sysdeps/libm-ieee754/s_csinh.c')
-rw-r--r-- | sysdeps/libm-ieee754/s_csinh.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sysdeps/libm-ieee754/s_csinh.c b/sysdeps/libm-ieee754/s_csinh.c index 98f06a558f..29a271fec6 100644 --- a/sysdeps/libm-ieee754/s_csinh.c +++ b/sysdeps/libm-ieee754/s_csinh.c @@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. */ #include <complex.h> +#include <fenv.h> #include <math.h> #include "math_private.h" @@ -41,12 +42,13 @@ __csinh (__complex__ double x) { /* Imaginary part is finite. */ double sinh_val = __ieee754_sinh (__real__ x); + double cosh_val = __ieee754_cosh (__real__ x); double sinix, cosix; __sincos (__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 +60,20 @@ __csinh (__complex__ double x) /* Real part is 0.0. */ __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0); __imag__ retval = __nan ("") + __nan (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif } else { __real__ retval = __nan (""); __imag__ retval = __nan (""); + +#ifdef FE_INVALID + feraiseexcept (FE_INVALID); +#endif } } } @@ -93,6 +104,11 @@ __csinh (__complex__ double x) /* The addition raises the invalid exception. */ __real__ retval = HUGE_VAL; __imag__ retval = __nan ("") + __nan (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif } } else |