summaryrefslogtreecommitdiff
path: root/numpy/lib/scimath.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-10-11 23:28:16 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-10-11 23:28:16 +0000
commit1031df26af6d9b209458fb229a987247bf2d5497 (patch)
tree8ab63ac3ab8bc526fab69bae6ff0888a14e07b06 /numpy/lib/scimath.py
parentbafea8e5b00acabaf3f6688764bd33706a892cef (diff)
downloadnumpy-1031df26af6d9b209458fb229a987247bf2d5497.tar.gz
Fix scimath.power for negative integer input.
Diffstat (limited to 'numpy/lib/scimath.py')
-rw-r--r--numpy/lib/scimath.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/lib/scimath.py b/numpy/lib/scimath.py
index 4f5a3ec0c..c15f254a3 100644
--- a/numpy/lib/scimath.py
+++ b/numpy/lib/scimath.py
@@ -31,6 +31,12 @@ def _fix_real_lt_zero(x):
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 log2(x):
def power(x, p):
x = _fix_real_lt_zero(x)
+ p = _fix_int_lt_zero(p)
return nx.power(x, p)
def arccos(x):