Serhiy Storchaka added the comment:
"%s" rounds float representation to 12 digits in Python 2.7. Replace "%s" with
"%r" and you will get precise representation of floats.
int(4.01)= 4
int(0.019574)= 0
int(0.03915) = 0
int(0.09787)
Eryk Sun added the comment:
Use %r instead of %s to show the repr. Hopefully that should clear things up
for you. int() truncates toward 0. The float in this case is slightly less than
1.
--
nosy: +eryksun
resolution: -> not a bug
stage: -> resolved
status: open -> closed
__
New submission from Tri Nguyen:
This code below shows a situation when Python int() library would return a
value of int(1.0) -> 0.0
---CODE
CHANGES = [1.00, 0.50, 0.25, 0.10, 0.05, 0.01]
# This code was originally to solve the least number of changes nee