You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ENH: confirm accuracy of basic math functions #13515
We do not verify results of our math functions (sin, cos, exp, log, ...) against a "gold standard" which makes changing the algorithms used to calculate them tricky. Python has a tests based on generating "true" values for certain interesting cases. We should explore adding these kinds of tests for the various built-in float and integer types, perhaps mpmath could help generate the "true" values.
see all the test-out files, they include input output and exceptions
other files define the current maximal error for all the different architectures and rounding modes
Python has a test suite for complex numbers when testing cmath based on a text file of results, we should be consistent with these results or document why we differ.
Activity
mattip commentedon May 9, 2019
See also this email thread from 2012 with the author of the python test files on using mpfr to calculate the results
seberg commentedon May 9, 2019
Not sure it is relevant, but there was also just this to do testing for scipy on scipy-dev: https://mail.python.org/pipermail/scipy-dev/2019-May/023508.html
juliantaylor commentedon May 9, 2019
glibc has a testsuite for math functions which could be used as input for what is interesting to test:
https://sourceware.org/git/?p=glibc.git;a=blob;f=math/README.libm-test;h=53172bbff87ff54e2f93ecc142fb607a2b350650;hb=HEAD
see all the test-out files, they include input output and exceptions
other files define the current maximal error for all the different architectures and rounding modes
mattip commentedon May 22, 2019
Python has a test suite for complex numbers when testing cmath based on a text file of results, we should be consistent with these results or document why we differ.
r-devulap commentedon Jul 19, 2019
PR #14048 addressed this issue for float32 exp, log, sin and cos.
r-devulap commentedon Jul 16, 2021
PR #19485 can hopefully close this issue?
mattip commentedon Mar 16, 2023
Closing, we now have better accuracy tests