[pypy-commit] pypy numpy-fixes: test, redo complex floordiv to avoid overflow if possible
mattip
noreply at buildbot.pypy.org
Sun Apr 26 23:26:02 CEST 2015
Author: mattip <matti.picus at gmail.com>
Branch: numpy-fixes
Changeset: r76942:9ea844c184eb
Date: 2015-04-26 23:33 +0300
http://bitbucket.org/pypy/pypy/changeset/9ea844c184eb/
Log: test, redo complex floordiv to avoid overflow if possible
diff --git a/pypy/module/micronumpy/test/test_complex.py b/pypy/module/micronumpy/test/test_complex.py
--- a/pypy/module/micronumpy/test/test_complex.py
+++ b/pypy/module/micronumpy/test/test_complex.py
@@ -486,12 +486,16 @@
assert c[i] == max(a[i], b[i])
- def test_abs_overflow(self):
- from numpy import array, absolute, isinf
+ def test_complex_overflow(self):
+ from numpy import array, absolute, isinf, complex128, floor_divide
a = array(complex(1.5e308,1.5e308))
# Prints a RuntimeWarning, but does not raise
b = absolute(a)
assert isinf(b)
+ c = array([1.e+110, 1.e-110], dtype=complex128)
+ d = floor_divide(c**2, c)
+ assert (d == [1.e+110, 0]).all()
+
def test_basic(self):
@@ -598,7 +602,7 @@
# but numpy.raises a TypeError
if '__pypy__' in sys.builtin_module_names:
exct, excm = TypeError, 'readonly attribute'
- else:
+ else :
exct, excm = AttributeError, 'is not writable'
exc = raises(exct, 'c2.real = 10.')
assert excm in exc.value[0]
More information about the pypy-commit
mailing list