python 3.44 float addition bug?

Gregory Ewing greg.ewing at canterbury.ac.nz
Tue Jun 24 01:30:41 EDT 2014


buck wrote:
> What's the recommended way to do this now?
> 
>>>>format(.01 + .01 + .01 + .01 + .01 + .01, 'g') == format(.06, 'g')

There's no recommended way. What you're asking for can't be
done. Whatever trick you come up with, there will be cases
where it doesn't work.

Why do you think you want to compare floats for equality?
The best thing to do will depend on the answer to that.

-- 
Greg



More information about the Python-list mailing list