Let's do the same comparisons as in the previous Time for action tutorial, but specify a maxulp
of 2
when necessary:
finfo
function:eps = np.finfo(float).eps print "EPS", eps
The epsilon would be:
EPS 2.22044604925e-16
assert_array_max_ulp
function with the appropriate maxulp
value:print "1", np.testing.assert_array_max_ulp(1.0, 1.0 + eps) print "2", np.testing.assert_array_max_ulp(1.0, 1 + 2 * eps, maxulp=2)
The output:
1 1.0 2 2.0