Why 3.0/5.0 = 0.59999...
peace.is.our.profession at gmx.de
Tue May 9 10:21:27 CEST 2006
> When I type 3.0/5.0, the result is 0.59999...
>>> print (3.0/5.0)
> Is there some precision loss? And how to overcome it?
Make sure the result gets piped
through some floating point con-
version (like print, %s etc.)
BTW, the 0.59999999999999998 value
is the "exact" calculated value
corresponding to your floating point
accuracy (34/2 digits).
More information about the Python-list