Obviously, float comparison is always tricky. I have a lot of assert-check in my (scientific) code, so very often I have to check for equality of sums to one, and similar is
Any fixed tolerance will fail if you put in very large or very small numbers, simplest solution is to use eps to get the double precision:
eps
abs(A-B)
The 4 is a totally arbitrary number, which is sufficient in most cases.