[Cython] Fixed implementation of absolute error tolerances in unit tests
This commit is contained in:
parent
5252c41a80
commit
7869bd09c3
1 changed files with 2 additions and 1 deletions
|
|
@ -1,9 +1,10 @@
|
|||
import numpy as np
|
||||
import unittest
|
||||
|
||||
|
||||
class CanteraTest(unittest.TestCase):
|
||||
def assertNear(self, a, b, rtol=1e-8, atol=1e-12, msg=None):
|
||||
cmp = 2 * abs(a - b)/(abs(a) + abs(b) + atol)
|
||||
cmp = 2 * abs(a - b)/(abs(a) + abs(b) + 2 * atol / rtol)
|
||||
if cmp > rtol:
|
||||
message = ('AssertNear: %.14g - %.14g = %.14g\n' % (a, b, a-b) +
|
||||
'Relative error of %10e exceeds rtol = %10e' % (cmp, rtol))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue