[pypy-commit] pypy py3.5: test and fix: math.logN(very_large_int)

arigo pypy.commits at gmail.com
Thu Nov 17 10:36:09 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r88447:5b3bd2f5c4ef
Date: 2016-11-17 16:35 +0100
http://bitbucket.org/pypy/pypy/changeset/5b3bd2f5c4ef/

Log:	test and fix: math.logN(very_large_int)

diff --git a/pypy/module/math/interp_math.py b/pypy/module/math/interp_math.py
--- a/pypy/module/math/interp_math.py
+++ b/pypy/module/math/interp_math.py
@@ -191,7 +191,9 @@
     try:
         try:
             x = _get_double(space, w_x)
-        except OverflowError:
+        except OperationError as e:
+            if not e.match(space, space.w_OverflowError):
+                raise
             if not space.isinstance_w(w_x, space.w_int):
                 raise
             # special case to support log(extremely-large-long)
diff --git a/pypy/module/math/test/test_math.py b/pypy/module/math/test/test_math.py
--- a/pypy/module/math/test/test_math.py
+++ b/pypy/module/math/test/test_math.py
@@ -167,6 +167,10 @@
         self.ftest(math.log10(100), 2)
         self.ftest(math.log10(0.01), -2)
 
+    def test_log_largevalue(self):
+        import math
+        assert math.log2(2**1234) == 1234.0
+
     def test_acosh(self):
         import math
         self.ftest(math.acosh(1), 0)


More information about the pypy-commit mailing list