summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-07-08 16:04:33 -0600
committerGitHub <noreply@github.com>2018-07-08 16:04:33 -0600
commit7cd94f262b1b12d29f7903195098903cd0e9db22 (patch)
tree99c8ea367c836f23539cc7a14509866cb5affac1 /numpy/lib/tests/test_function_base.py
parentd89bc4bbf541affbcf87498ff4af86b9451480cd (diff)
parent307dd76cb0fb770e07524e4cd29cd08e17edc2c3 (diff)
downloadnumpy-7cd94f262b1b12d29f7903195098903cd0e9db22.tar.gz
Merge pull request #11464 from eric-wieser/monotonicity
BUG: Don't convert inputs to `np.float64` in digitize
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index d2a9181db..ba5b90e8c 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -1510,6 +1510,18 @@ class TestDigitize(object):
assert_(not isinstance(digitize(b, a, False), A))
assert_(not isinstance(digitize(b, a, True), A))
+ def test_large_integers_increasing(self):
+ # gh-11022
+ x = 2**54 # loses precision in a float
+ assert_equal(np.digitize(x, [x - 1, x + 1]), 1)
+
+ @pytest.mark.xfail(
+ reason="gh-11022: np.core.multiarray._monoticity loses precision")
+ def test_large_integers_decreasing(self):
+ # gh-11022
+ x = 2**54 # loses precision in a float
+ assert_equal(np.digitize(x, [x + 1, x - 1]), 1)
+
class TestUnwrap(object):