1. jaeyeun
  2. pypy

Commits

Taavi Burns  committed 2a1a614

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

  • Participants
  • Parent commits 382d1c9
  • Branches numpy-ufuncs3

Comments (0)

Files changed (1)

File pypy/module/micronumpy/test/test_ufuncs.py

View file
  • Ignore whitespace
 
     def test_logaddexp(self):
         import math
+        import sys
         from _numpypy import logaddexp
 
         # From the numpy documentation
 
         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')))
 
     def test_logaddexp2(self):
         import math
+        import sys
         from _numpypy import logaddexp2
         log2 = math.log(2)
 
 
         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')))