abs(a - b) <= (atol + rtol * abs(b))
vs
(abs(a - b) <= atol
or
abs(a - b) / max(abs(a), abs(b)) < rtol)
Docs: numpy.allclose, mpmath.almosteq -- Source: numpy, mpmath
How do these schemes differ? An obvious one is that allclose
is and
while almosteq
is or
with respect to the tolerances. To me the and
makes more sense, yet mpmath
is a library dedicated to precision, so I find this strange.
When is almosteq
preferred over allclose
, speed/memory aside? (Optional question, can one's rtol
be converted to another's rough equivalent)?