[Numpy-svn] r3313 - trunk/numpy/lib

numpy-svn at scipy.org numpy-svn at scipy.org
Wed Oct 11 19:28:17 EDT 2006


Author: oliphant
Date: 2006-10-11 18:28:16 -0500 (Wed, 11 Oct 2006)
New Revision: 3313

Modified:
   trunk/numpy/lib/scimath.py
Log:
Fix scimath.power for negative integer input.

Modified: trunk/numpy/lib/scimath.py
===================================================================
--- trunk/numpy/lib/scimath.py	2006-10-11 21:22:58 UTC (rev 3312)
+++ trunk/numpy/lib/scimath.py	2006-10-11 23:28:16 UTC (rev 3313)
@@ -31,6 +31,12 @@
         x = _tocomplex(x)
     return x
 
+def _fix_int_lt_zero(x):
+    x = asarray(x)
+    if any(isreal(x) & (x < 0)):
+        x = x * 1.0
+    return x
+
 def _fix_real_abs_gt_1(x):
     x = asarray(x)
     if any(isreal(x) & (abs(x)>1)):
@@ -64,6 +70,7 @@
 
 def power(x, p):
     x = _fix_real_lt_zero(x)
+    p = _fix_int_lt_zero(p)
     return nx.power(x, p)
 
 def arccos(x):




More information about the Numpy-svn mailing list