summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2011-05-09 13:02:45 (GMT)
committerMark Dickinson <mdickinson@enthought.com>2011-05-09 13:02:45 (GMT)
commitdf77e3d4a07223ebfe049e66d4d8a8c0b4315e04 (patch)
treeb3f4c6aef2318442fde6ba0836bf78ec5c28e603
parent86e104a6ab8d81916a13b01ec892dd006a033359 (diff)
downloadcpython-df77e3d4a07223ebfe049e66d4d8a8c0b4315e04.zip
cpython-df77e3d4a07223ebfe049e66d4d8a8c0b4315e04.tar.gz
cpython-df77e3d4a07223ebfe049e66d4d8a8c0b4315e04.tar.bz2
Issue #11188: In log2 tests, create powers of 2 using ldexp(1, n) instead of the less reliable 2.0**n.
-rw-r--r--Lib/test/test_math.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index 3b80bb6..81080f2 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -653,8 +653,8 @@ class MathTests(unittest.TestCase):
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