[Numpy-svn] r6115 - trunk/numpy/core/src

numpy-svn@scip... numpy-svn@scip...
Thu Nov 27 21:52:25 CST 2008


Author: charris
Date: 2008-11-27 21:52:16 -0600 (Thu, 27 Nov 2008)
New Revision: 6115

Modified:
   trunk/numpy/core/src/umath_funcs_c99.inc.src
Log:
Make numpy version of atanh more robust.
Numpy log1p still needs a major overhaul.

Modified: trunk/numpy/core/src/umath_funcs_c99.inc.src
===================================================================
--- trunk/numpy/core/src/umath_funcs_c99.inc.src	2008-11-27 20:26:04 UTC (rev 6114)
+++ trunk/numpy/core/src/umath_funcs_c99.inc.src	2008-11-28 03:52:16 UTC (rev 6115)
@@ -181,7 +181,12 @@
 static double
 npy_atanh(double x)
 {
-    return 0.5*log1p(2.0*x/(1.0-x));
+    if (x > 0) {
+        return -0.5*log1p(-2.0*x/(1.0 + x));
+    }
+    else {
+        return 0.5*log1p(2.0*x/(1.0 - x));
+    }
 }
 #define atanh npy_atanh
 #else



More information about the Numpy-svn mailing list