Numbers in python

Duncan Booth duncan.booth at invalid.invalid
Fri Mar 10 09:51:35 EST 2006


 wrote:

> If I put them in the dictionary as 'THE' = int(0.965) the
> program returns 1.0 and if I put 'THE' = float(0.965) it returns
> 0.96555555549 or something similar. Neither of these are right!

Your system seems to be really screwed. int(0.965) should be 0, and 
float(0.965) should be 0.96499999999999997 or something similar.

Read
http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate




More information about the Python-list mailing list