I have such snippet of code:
eps = 0.1
xx = np.array([[1,2,3], [4,5,6], [7,8,9]])
yy = np.array([[1.1,2.1,3.1], [4.1,5.1,6.1], [7.1,8.1,9.2]])
dif = np.absolute(xx - yy)
print dif
print dif < eps
Result:
[[ 0.1 0.1 0.1]
[ 0.1 0.1 0.1]
[ 0.1 0.1 0.2]]
[[False False False]
[ True True True]
[ True True False]]
Why we get such result? In the first row the comparison is correct but in second and in the third row the result is unexpected for me.
It's because of float comparison and floating point? With help of guys I understand the problem!