From 8cf28c5ebe7b02e769a3f3082fd390e6d8c11542 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 31 Jan 2013 22:55:29 +0000 Subject: Fix casinh spurious underflows away from [-i,i] (bug 15062). --- math/k_casinhf.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'math/k_casinhf.c') diff --git a/math/k_casinhf.c b/math/k_casinhf.c index 9401636348..3152ea2f7d 100644 --- a/math/k_casinhf.c +++ b/math/k_casinhf.c @@ -57,6 +57,26 @@ __kernel_casinhf (__complex__ float x, int adj) res = __clogf (y); __real__ res += (float) M_LN2; } + else if (rx >= 0.5f && ix < FLT_EPSILON / 8.0f) + { + float s = __ieee754_hypotf (1.0f, rx); + + __real__ res = __ieee754_logf (rx + s); + if (adj) + __imag__ res = __ieee754_atan2f (s, __imag__ x); + else + __imag__ res = __ieee754_atan2f (ix, s); + } + else if (rx < FLT_EPSILON / 8.0f && ix >= 1.5f) + { + float s = __ieee754_sqrtf ((ix + 1.0f) * (ix - 1.0f)); + + __real__ res = __ieee754_logf (ix + s); + if (adj) + __imag__ res = __ieee754_atan2f (rx, __copysignf (s, __imag__ x)); + else + __imag__ res = __ieee754_atan2f (s, rx); + } else { __real__ y = (rx - ix) * (rx + ix) + 1.0; -- cgit 1.4.1