PyDynamic
PyDynamic copied to clipboard
Introduce an absolute tolerance into all assert_allclose() statements
This PR defines a variable "custom_atol=100*machine_epsilon
" in the conftest.py
and uses it in all assert_allclose statements, that did not already declare a (larger) absolute tolerance previously.
Motivation: numpy.testing.assert_allclose
uses default values of rtol=1e-7
and atol=0
. This is sometimes difficult to achieve if mathematically equivalent but numerically different routines are compared, especially for array entries close to zero. The proposed absolute tolerance should provide a good compromise between achievable numerical accuracy and detecting true deviation of arrays in tests.