diff options
Diffstat (limited to 'math/s_catanl.c')
-rw-r--r-- | math/s_catanl.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/math/s_catanl.c b/math/s_catanl.c index 57d2e59550..e04dba7387 100644 --- a/math/s_catanl.c +++ b/math/s_catanl.c @@ -61,7 +61,7 @@ __catanl (__complex__ long double x) } else { - long double r2, num, den; + long double r2, num, den, f; r2 = __real__ x * __real__ x; @@ -75,7 +75,14 @@ __catanl (__complex__ long double x) den = __imag__ x - 1.0; den = r2 + den * den; - __imag__ res = 0.25 * __ieee754_logl (num / den); + f = num / den; + if (f < 0.5) + __imag__ res = 0.25 * __ieee754_logl (f); + else + { + num = 4.0 * __imag__ x; + __imag__ res = 0.25 * __log1pl (num / den); + } } return res; |