Closed Mateasek closed 4 years ago
Traceback (most recent call last):
File "/home/travis/build/raysect/source/raysect/core/math/function/function1d/tests/test_cmath.py", line 113, in test_erf
self.assertEqual(function(x), expected, "Erf1D call did not match reference value.")
AssertionError: -0.00011283791633342487 != -0.00011283791633342489 : Erf1D call did not match reference value.
Could this be caused by Differences in algorithms used by c and python?
Traceback (most recent call last): File "/home/travis/build/raysect/source/raysect/core/math/function/function1d/tests/test_cmath.py", line 113, in test_erf self.assertEqual(function(x), expected, "Erf1D call did not match reference value.") AssertionError: -0.00011283791633342487 != -0.00011283791633342489 : Erf1D call did not match reference value.
Could this be caused by Differences in algorithms used by c and python?
Yes, it is possible they are using a slightly different version implementation of the algorithm leading to small differences. You;ll need to switch the assert to AlmostEqual and specify a tolerance. See the other tests for an example of it's usage. I recommend setting an absolute tolerance by taking the expected value and multiplying by a suitable small number e.g. 1e-10.
Other than the minor comments in the review, this looks good. Thanks @Mateasek.
I used the AssertAlmostEqual with 10 decimals precition for the value tests of the error function. We can get a little bit higher to 15 decimals for example, if needed.
Excellent, thanks @Mateasek.
Adding error function and square root into function1D framewrok
related to #305