Precision for equality of two floats?

Anton81 berrybear at gmx.net
Mon Nov 28 10:36:49 EST 2005


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



More information about the Python-list mailing list