summaryrefslogtreecommitdiff
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.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/sysdeps/libm-ieee754/s_csinhl.c b/sysdeps/libm-ieee754/s_csinhl.c
index e403dd4796..8388a40b46 100644
--- a/sysdeps/libm-ieee754/s_csinhl.c
+++ b/sysdeps/libm-ieee754/s_csinhl.c
@@ -21,34 +21,38 @@
#include <complex.h>
#include <math.h>
+#include "math_private.h"
+
__complex__ long double
__csinhl (__complex__ long double x)
{
__complex__ long double retval;
int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
- __real__ x = fabs (__real__ x);
+ __real__ x = fabsl (__real__ x);
- if (isfinite (__real__ x))
+ if (rcls >= FP_ZERO)
{
- if (isfinite (__imag__ x))
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
{
- long double exp_val = __expl (__real__ x);
- long double rec_exp_val = 1.0 / exp_val;
+ /* Imaginary part is finite. */
+ long double sinh_val = __ieee754_sinhl (__real__ x);
- __real__ retval = (0.5 * (exp_val - rec_exp_val)
- * __cosl (__imag__ x));
- __imag__ retval = (0.5 * (exp_val - rec_exp_val)
- * __sinl (__imag__ x));
+ __real__ retval = sinh_val * __cosl (__imag__ x);
+ __imag__ retval = sinh_val * __sinl (__imag__ x);
if (negate)
__real__ retval = -__real__ retval;
}
else
{
- if (__real__ x == 0)
+ if (rcls == FP_ZERO)
{
+ /* Real part is 0.0. */
__real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
__imag__ retval = __nanl ("") + __nanl ("");
}
@@ -59,15 +63,18 @@ __csinhl (__complex__ long double x)
}
}
}
- else if (__isinfl (__real__ x))
+ else if (rcls == FP_INFINITE)
{
- if (__imag__ x == 0.0)
+ /* Real part is infinite. */
+ if (icls == FP_ZERO)
{
+ /* Imaginary part is 0.0. */
__real__ retval = negate ? -HUGE_VALL : HUGE_VALL;
__imag__ retval = __imag__ x;
}
- else if (isfinite (__imag__ x))
+ else if (icls > FP_ZERO)
{
+ /* Imaginary part is finite. */
__real__ retval = __copysignl (HUGE_VALL, __cosl (__imag__ x));
__imag__ retval = __copysignl (HUGE_VALL, __sinl (__imag__ x));
@@ -83,16 +90,8 @@ __csinhl (__complex__ long double x)
}
else
{
- if (__imag__ x == 0.0)
- {
- __real__ retval = __nanl ("");
- __imag__ retval = __imag__ x;
- }
- else
- {
- __real__ retval = __nanl ("");
- __imag__ retval = __nanl ("");
- }
+ __real__ retval = __nanl ("");
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl ("");
}
return retval;