mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
GH-100485: Create an alternative code path when an accurate fma() implementation is not available (#101567)
This commit is contained in:
parent
a89e6713c4
commit
5a2b984568
2 changed files with 48 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue