diff options
Diffstat (limited to 'math/s_catanf.c')
-rw-r--r-- | math/s_catanf.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/math/s_catanf.c b/math/s_catanf.c index 5a432471cd..0dc85ffc25 100644 --- a/math/s_catanf.c +++ b/math/s_catanf.c @@ -61,7 +61,7 @@ __catanf (__complex__ float x) } else { - float r2, num, den; + float r2, num, den, f; r2 = __real__ x * __real__ x; @@ -75,7 +75,14 @@ __catanf (__complex__ float x) den = __imag__ x - 1.0; den = r2 + den * den; - __imag__ res = 0.25 * __ieee754_logf (num / den); + f = num / den; + if (f < 0.5) + __imag__ res = 0.25 * __ieee754_logf (f); + else + { + num = 4.0 * __imag__ x; + __imag__ res = 0.25 * __log1pf (num / den); + } } return res; |