Precision for equality of two floats?

gene tani gene.tani at
Tue Nov 29 16:41:33 CET 2005

Anton81 wrote:
> Hi!
> When I do simple calculation with float values, they are rarely exactly
> equal even if they should be. What is the threshold and how can I change
> it?
> e.g. "if f1==f2:" will always mean "if abs(f1-f2)<1e-6:"
> Anton

googled for "floating point" "comparison tolerance"

More information about the Python-list mailing list