[Python-checkins] cpython: Issue #11188: In log2 tests, create powers of 2 using ldexp(1, n) instead of
mark.dickinson
python-checkins at python.org
Mon May 9 15:02:49 CEST 2011
http://hg.python.org/cpython/rev/1f23d63b578c
changeset: 69979:1f23d63b578c
user: Mark Dickinson <mdickinson at enthought.com>
date: Mon May 09 14:02:45 2011 +0100
summary:
Issue #11188: In log2 tests, create powers of 2 using ldexp(1, n) instead of the less reliable 2.0**n.
files:
Lib/test/test_math.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -653,8 +653,8 @@
def testLog2(self):
self.assertRaises(TypeError, math.log2)
# Check that we get exact equality for log2 of powers of 2.
- actual = [math.log2(2.0**n) for n in range(-324, 1024)]
- expected = [float(n) for n in range(-324, 1024)]
+ actual = [math.log2(math.ldexp(1.0, n)) for n in range(-1074, 1024)]
+ expected = [float(n) for n in range(-1074, 1024)]
self.assertEqual(actual, expected)
# Check some integer values
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list