diff options
Diffstat (limited to 'math/s_ctanhf.c')
-rw-r--r-- | math/s_ctanhf.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/math/s_ctanhf.c b/math/s_ctanhf.c index e505155774..ca36a83bfb 100644 --- a/math/s_ctanhf.c +++ b/math/s_ctanhf.c @@ -83,10 +83,22 @@ __ctanhf (__complex__ float x) } else { - float sinhrx = __ieee754_sinhf (__real__ x); - float coshrx = __ieee754_coshf (__real__ x); + float sinhrx, coshrx; + if (fabsf (__real__ x) > FLT_MIN) + { + sinhrx = __ieee754_sinhf (__real__ x); + coshrx = __ieee754_coshf (__real__ x); + } + else + { + sinhrx = __real__ x; + coshrx = 1.0f; + } - den = sinhrx * sinhrx + cosix * cosix; + if (fabsf (sinhrx) > fabsf (cosix) * FLT_EPSILON) + den = sinhrx * sinhrx + cosix * cosix; + else + den = cosix * cosix; __real__ res = sinhrx * coshrx / den; __imag__ res = sinix * cosix / den; } |