Should allclose() be commutative, so as to prevent the following:

>>> x = 1.00001001

>>> allclose(x,1), allclose(1,x)

(False, True)

There is some discussion here which provides two possible solutions:

http://www.boost.org/doc/libs/1_35_0/libs/test/doc/components/test_tools/floating_point_comparison.htmlNotice, the discussion states that their solutions are not

transitive---nevertheless, I think commutativity is a worthwhile

improvement. Also, they mention that rtol * abs(y) can cause

underflow issues. Thus, they implement,

|x-y|/|y| <= rtol AND(OR) |x-y|/|x| <= rtol

without an atol option, rather than

|x-y| <= atol + rtol* |y|

Naively, it seems like atol is attempting to correct this very issue.

So do we really need atol?

_______________________________________________

Numpy-discussion mailing list

[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion