summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_math.py
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2023-02-04 23:54:44 (GMT)
committerGitHub <noreply@github.com>2023-02-04 23:54:44 (GMT)
commit5a2b984568f72f0d7ff7c7b4ee8ce31af9fd1b7e (patch)
tree85f0b9aa3fcb80a41332f7adc94f57c41bd70285 /Lib/test/test_math.py
parenta89e6713c4de99d4be5a1304b134e57a24ab10ac (diff)
downloadcpython-5a2b984568f72f0d7ff7c7b4ee8ce31af9fd1b7e.zip
cpython-5a2b984568f72f0d7ff7c7b4ee8ce31af9fd1b7e.tar.gz
cpython-5a2b984568f72f0d7ff7c7b4ee8ce31af9fd1b7e.tar.bz2
GH-100485: Create an alternative code path when an accurate fma() implementation is not available (#101567)
Diffstat (limited to 'Lib/test/test_math.py')
-rw-r--r--Lib/test/test_math.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index 2c84e55..8d84904 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -1450,6 +1450,11 @@ class MathTests(unittest.TestCase):
n = 20 # Length of vectors
c = 1e30 # Target condition number
+ # If the following test fails, it means that the C math library
+ # implementation of fma() is not compliant with the C99 standard
+ # and is inaccurate. To solve this problem, make a new build
+ # with the symbol UNRELIABLE_FMA defined. That will enable a
+ # slower but accurate code path that avoids the fma() call.
relative_err = median(Trial(math.sumprod, c, n) for i in range(times))
self.assertLess(relative_err, 1e-16)