diff options
Diffstat (limited to 'sysdeps/libm-ieee754/s_ccosh.c')
-rw-r--r-- | sysdeps/libm-ieee754/s_ccosh.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sysdeps/libm-ieee754/s_ccosh.c b/sysdeps/libm-ieee754/s_ccosh.c index fa958f4..1e92f03 100644 --- a/sysdeps/libm-ieee754/s_ccosh.c +++ b/sysdeps/libm-ieee754/s_ccosh.c @@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. */ #include <complex.h> +#include <fenv.h> #include <math.h> #include "math_private.h" @@ -39,18 +40,24 @@ __ccosh (__complex__ double x) if (icls >= FP_ZERO) { /* 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 = cosh_val * cosix; - __imag__ retval = cosh_val * sinix; + __imag__ retval = sinh_val * sinix; } else { __imag__ retval = __real__ x == 0.0 ? 0.0 : __nan (""); __real__ retval = __nan ("") + __nan (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif } } else if (rcls == FP_INFINITE) @@ -77,6 +84,11 @@ __ccosh (__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 |