Skip to content

Commit

Permalink
Make "underflow" case more reliable in relative error test.
Browse files Browse the repository at this point in the history
  • Loading branch information
skrah committed Apr 9, 2019
1 parent a20d8e1 commit a20ed56
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/test_gumath.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,8 +997,9 @@ def assertRelErrorLess(self, calc, expected, maxerr, msg):
return
elif cmath.isinf(calc) or cmath.isinf(expected):
return
elif abs(expected) < 1e-5 and abs(calc) < 1e-5:
return
elif abs(expected) < 1e-5 or abs(calc) < 1e-5:
self.assertLess(abs(calc), 1e-5, msg)
self.assertLess(abs(expected), 1e-5, msg)
else:
err = abs((calc-expected) / expected)
self.assertLess(err, maxerr, msg)
Expand Down

0 comments on commit a20ed56

Please sign in to comment.