about summary refs log tree commit diff
path: root/sysdeps/libm-ieee754/s_catanhf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754/s_catanhf.c')
-rw-r--r--sysdeps/libm-ieee754/s_catanhf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sysdeps/libm-ieee754/s_catanhf.c b/sysdeps/libm-ieee754/s_catanhf.c
index 5d195be905..ac0ed17edb 100644
--- a/sysdeps/libm-ieee754/s_catanhf.c
+++ b/sysdeps/libm-ieee754/s_catanhf.c
@@ -62,17 +62,17 @@ __catanhf (__complex__ float x)
 
       i2 = __imag__ x * __imag__ x;
 
-      num = 1.0 - __real__ x;
+      num = 1.0 + __real__ x;
       num = i2 + num * num;
 
-      den = 1.0 + __real__ x;
+      den = 1.0 - __real__ x;
       den = i2 + den * den;
 
-      __real__ res = 0.25 * __ieee754_logf (num / den);
+      __real__ res = 0.25 * (__ieee754_logf (num) - __ieee754_logf (den));
 
       den = 1 - __real__ x * __real__ x - i2;
 
-      __imag__ res = 0.5 * __atanf ((2.0 * __imag__ x) / den);
+      __imag__ res = 0.5 * __ieee754_atan2f (2.0 * __imag__ x, den);
     }
 
   return res;