diff options
Diffstat (limited to 'math/s_catanh.c')
-rw-r--r-- | math/s_catanh.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/math/s_catanh.c b/math/s_catanh.c index 5371f44b67..0ee8c64b6f 100644 --- a/math/s_catanh.c +++ b/math/s_catanh.c @@ -64,7 +64,14 @@ __catanh (__complex__ double x) double den = 1.0 - __real__ x; den = i2 + den * den; - __real__ res = 0.25 * (__ieee754_log (num) - __ieee754_log (den)); + double f = num / den; + if (f < 0.5) + __real__ res = 0.25 * __ieee754_log (f); + else + { + num = 4.0 * __real__ x; + __real__ res = 0.25 * __log1p (num / den); + } den = 1 - __real__ x * __real__ x - i2; |