aboutsummaryrefslogtreecommitdiff
path: root/math/s_ctanhl.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/s_ctanhl.c')
-rw-r--r--math/s_ctanhl.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/math/s_ctanhl.c b/math/s_ctanhl.c
index e5d677903f..dbf1612707 100644
--- a/math/s_ctanhl.c
+++ b/math/s_ctanhl.c
@@ -83,10 +83,22 @@ __ctanhl (__complex__ long double x)
}
else
{
- long double sinhrx = __ieee754_sinhl (__real__ x);
- long double coshrx = __ieee754_coshl (__real__ x);
+ long double sinhrx, coshrx;
+ if (fabsl (__real__ x) > LDBL_MIN)
+ {
+ sinhrx = __ieee754_sinhl (__real__ x);
+ coshrx = __ieee754_coshl (__real__ x);
+ }
+ else
+ {
+ sinhrx = __real__ x;
+ coshrx = 1.0L;
+ }
- den = sinhrx * sinhrx + cosix * cosix;
+ if (fabsl (sinhrx) > fabsl (cosix) * LDBL_EPSILON)
+ den = sinhrx * sinhrx + cosix * cosix;
+ else
+ den = cosix * cosix;
__real__ res = sinhrx * coshrx / den;
__imag__ res = sinix * cosix / den;
}