summaryrefslogtreecommitdiff
path: root/numpy/core/numeric.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2014-02-15 16:38:43 -0700
committerCharles Harris <charlesr.harris@gmail.com>2014-02-15 16:38:43 -0700
commit2868dc4a0513f58eafc013f3ba3d84ae07113199 (patch)
tree04649bc8cda222eeb06a893070e2b3e9699758a8 /numpy/core/numeric.py
parente246cc79de16d54ce9b127d5faf625adb6da5f0b (diff)
parentab04e1ae0e8eca717bc7e42f3b0a60c9ff764289 (diff)
downloadnumpy-2868dc4a0513f58eafc013f3ba3d84ae07113199.tar.gz
Merge pull request #4105 from seberg/deprecate-boolean-math
DEP: Deprecate boolean math operations
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r--numpy/core/numeric.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index 39e5a4cd5..3b8e52e71 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -2139,6 +2139,11 @@ def allclose(a, b, rtol=1.e-5, atol=1.e-8):
x = array(a, copy=False, ndmin=1)
y = array(b, copy=False, ndmin=1)
+ # make sure y is an inexact type to avoid abs(MIN_INT); will cause
+ # casting of x later.
+ dtype = multiarray.result_type(y, 1.)
+ y = array(y, dtype=dtype, copy=False)
+
xinf = isinf(x)
yinf = isinf(y)
if any(xinf) or any(yinf):
@@ -2154,7 +2159,7 @@ def allclose(a, b, rtol=1.e-5, atol=1.e-8):
# ignore invalid fpe's
with errstate(invalid='ignore'):
- r = all(less_equal(abs(x-y), atol + rtol * abs(y)))
+ r = all(less_equal(abs(x - y), atol + rtol * abs(y)))
return r