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_casinhl.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'math/k_casinhl.c') diff --git a/math/k_casinhl.c b/math/k_casinhl.c index 6412979..110ae33 100644 --- a/math/k_casinhl.c +++ b/math/k_casinhl.c @@ -64,6 +64,26 @@ __kernel_casinhl (__complex__ long double x, int adj) res = __clogl (y); __real__ res += M_LN2l; } + else if (rx >= 0.5L && ix < LDBL_EPSILON / 8.0L) + { + long double s = __ieee754_hypotl (1.0L, rx); + + __real__ res = __ieee754_logl (rx + s); + if (adj) + __imag__ res = __ieee754_atan2l (s, __imag__ x); + else + __imag__ res = __ieee754_atan2l (ix, s); + } + else if (rx < LDBL_EPSILON / 8.0L && ix >= 1.5L) + { + long double s = __ieee754_sqrtl ((ix + 1.0L) * (ix - 1.0L)); + + __real__ res = __ieee754_logl (ix + s); + if (adj) + __imag__ res = __ieee754_atan2l (rx, __copysignl (s, __imag__ x)); + else + __imag__ res = __ieee754_atan2l (s, rx); + } else { __real__ y = (rx - ix) * (rx + ix) + 1.0; -- cgit v1.1