[pypy-commit] pypy numpy-ufuncs3: Update logaddexp(2) tests to run correctly under cpython/numpy. The current micronumpy implementation is wrong; fix in next commit.

taavi_burns noreply at buildbot.pypy.org
Mon Apr 9 04:15:21 CEST 2012


Author: Taavi Burns <taavi.burns at gmail.com>
Branch: numpy-ufuncs3
Changeset: r54260:2a1a61463bd1
Date: 2012-04-08 22:14 -0400
http://bitbucket.org/pypy/pypy/changeset/2a1a61463bd1/

Log:	Update logaddexp(2) tests to run correctly under cpython/numpy. The
	current micronumpy implementation is wrong; fix in next commit.

diff --git a/pypy/module/micronumpy/test/test_ufuncs.py b/pypy/module/micronumpy/test/test_ufuncs.py
--- a/pypy/module/micronumpy/test/test_ufuncs.py
+++ b/pypy/module/micronumpy/test/test_ufuncs.py
@@ -763,6 +763,7 @@
 
     def test_logaddexp(self):
         import math
+        import sys
         from _numpypy import logaddexp
 
         # From the numpy documentation
@@ -773,7 +774,8 @@
 
         assert logaddexp(0, 0) == math.log(2)
         assert logaddexp(float('-inf'), 0) == 0
-        assert logaddexp(12345678, 12345678) == float('inf')
+        assert logaddexp(sys.float_info.max, sys.float_info.max) == sys.float_info.max
+        assert logaddexp(sys.float_info.min, sys.float_info.min) == math.log(2)
 
         assert math.isnan(logaddexp(float('nan'), 1))
         assert math.isnan(logaddexp(1, float('nan')))
@@ -786,6 +788,7 @@
 
     def test_logaddexp2(self):
         import math
+        import sys
         from _numpypy import logaddexp2
         log2 = math.log(2)
 
@@ -797,7 +800,8 @@
 
         assert logaddexp2(0, 0) == 1
         assert logaddexp2(float('-inf'), 0) == 0
-        assert logaddexp2(12345678, 12345678) == float('inf')
+        assert logaddexp2(sys.float_info.max, sys.float_info.max) == sys.float_info.max
+        assert logaddexp2(sys.float_info.min, sys.float_info.min) == 1.0
 
         assert math.isnan(logaddexp2(float('nan'), 1))
         assert math.isnan(logaddexp2(1, float('nan')))


More information about the pypy-commit mailing list