summary refs log tree commit diff
path: root/sysdeps/libm-ieee754/s_catanh.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754/s_catanh.c')
-rw-r--r--sysdeps/libm-ieee754/s_catanh.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sysdeps/libm-ieee754/s_catanh.c b/sysdeps/libm-ieee754/s_catanh.c
index 6c4b10e3db..0cb852a069 100644
--- a/sysdeps/libm-ieee754/s_catanh.c
+++ b/sysdeps/libm-ieee754/s_catanh.c
@@ -62,17 +62,17 @@ __catanh (__complex__ double 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_log (num / den);
+      __real__ res = 0.25 * (__ieee754_log (num) - __ieee754_log (den));
 
       den = 1 - __real__ x * __real__ x - i2;
 
-      __imag__ res = 0.5 * __atan ((2.0 * __imag__ x) / den);
+      __imag__ res = 0.5 * __ieee754_atan2 (2.0 * __imag__ x, den);
     }
 
   return res;