[pypy-svn] r16936 - in pypy/release/0.7.x/pypy/objspace/std: . test
pedronis at codespeak.net
pedronis at codespeak.net
Sun Aug 28 10:51:49 CEST 2005
Author: pedronis
Date: Sun Aug 28 10:51:47 2005
New Revision: 16936
Modified:
pypy/release/0.7.x/pypy/objspace/std/longobject.py
pypy/release/0.7.x/pypy/objspace/std/test/test_longobject.py
Log:
fix for math.log(long) should have been checked in the release branch in the first place (oops)
Modified: pypy/release/0.7.x/pypy/objspace/std/longobject.py
==============================================================================
--- pypy/release/0.7.x/pypy/objspace/std/longobject.py (original)
+++ pypy/release/0.7.x/pypy/objspace/std/longobject.py Sun Aug 28 10:51:47 2005
@@ -1293,6 +1293,8 @@
small enough to fit in an IEEE single. log and log10 are even smaller.
"""
x, e = _AsScaledDouble(w_arg);
+ if x <= 0.0:
+ raise ValueError
# Value is ~= x * 2**(e*SHIFT), so the log ~=
# log(x) + log(2) * e * SHIFT.
# CAUTION: e*SHIFT may overflow using int arithmetic,
Modified: pypy/release/0.7.x/pypy/objspace/std/test/test_longobject.py
==============================================================================
--- pypy/release/0.7.x/pypy/objspace/std/test/test_longobject.py (original)
+++ pypy/release/0.7.x/pypy/objspace/std/test/test_longobject.py Sun Aug 28 10:51:47 2005
@@ -395,3 +395,13 @@
assert hash(123456789L) == 123456789
assert hash(1234567890123456789L) == -1895067127
assert hash(-3**333) == -368329968
+
+ def math_log(self):
+ import math
+ raises(ValueError, math.log, 0L)
+ raises(ValueError, math.log, -1L)
+ raises(ValueError, math.log, -2L)
+ raises(ValueError, math.log, -(1L << 10000))
+ raises(ValueError, math.log, 0)
+ raises(ValueError, math.log, -1)
+ raises(ValueError, math.log, -2)
More information about the Pypy-commit
mailing list