Make the comparison something like
if(abs(a-b) <= 1e-6 * (a + b)):
This is standard practice when using floating point. The real value you use (instead of 1e-6) depends on the magnitude of the numbers you use and your definition of "the same".
EDIT I added *(a+b)
to give some robustness for values of different magnitudes, and changed the comparison to <=
rather than <
to cover the case where a==b==0.0
.