diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2020-08-16 02:38:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-16 02:38:19 (GMT) |
commit | fff3c28052e6b0750d6218e00acacd2fded4991a (patch) | |
tree | ce64915e0eca743b0f0c448b714f5e316adca18a /Lib/test | |
parent | 39dab24621122338d01c1219bb0acc46ba9c9956 (diff) | |
download | cpython-fff3c28052e6b0750d6218e00acacd2fded4991a.zip cpython-fff3c28052e6b0750d6218e00acacd2fded4991a.tar.gz cpython-fff3c28052e6b0750d6218e00acacd2fded4991a.tar.bz2 |
bpo-41513: Improve speed and accuracy of math.hypot() (GH-21803)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_math.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index e06b1e6..4d62eb1 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -795,7 +795,8 @@ class MathTests(unittest.TestCase): # Verify scaling for extremely large values fourthmax = FLOAT_MAX / 4.0 for n in range(32): - self.assertEqual(hypot(*([fourthmax]*n)), fourthmax * math.sqrt(n)) + self.assertTrue(math.isclose(hypot(*([fourthmax]*n)), + fourthmax * math.sqrt(n))) # Verify scaling for extremely small values for exp in range(32): @@ -904,8 +905,8 @@ class MathTests(unittest.TestCase): for n in range(32): p = (fourthmax,) * n q = (0.0,) * n - self.assertEqual(dist(p, q), fourthmax * math.sqrt(n)) - self.assertEqual(dist(q, p), fourthmax * math.sqrt(n)) + self.assertTrue(math.isclose(dist(p, q), fourthmax * math.sqrt(n))) + self.assertTrue(math.isclose(dist(q, p), fourthmax * math.sqrt(n))) # Verify scaling for extremely small values for exp in range(32): |