if you are looking for the best epsilon ever to get a better comparison, you can use python sys epsilon using :
>>> import sys >>> sys.float_info.epsilon 2.220446049250313e-16
but if you want this epsilon to be dynamically based on your a and b more, I would suggest going for:
abs(f1-f2) < tol*max(abs(f1),abs(f2))
or
abs(ab) <= max( rel_tol * max(abs(a), abs(b)), abs_tol )
source share