int((9.2-9.0)*10) is 1, int((9.21-9.0)*10) is 2, why?

bcm bluecrystalyj at gmail.com
Fri Sep 5 15:12:41 CEST 2008


Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on win32
The following line of code describes an  funny question:
>>> int((9.2-9.0)*10)
1
>>> int((9.21-9.0)*10)
2
>>> int((9.1-9.0)*10)
0
>>> int((9.11-9.0)*10)
1
>>> int((8.2-8.0)*10)
1
>>> int((8.23-8.0)*10)
2

why? anybody can explain it?



More information about the Python-list mailing list