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.019999999999999574)        = 0
int(0.03999999999999915)         = 0
int(0.09999999999999787)         = 0
int(0.19999999999999574)         = 0
int(0.9999999999999787)  = 0
R = 0.009999999999999787

See also https://docs.python.org/2/tutorial/floatingpoint.html .

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30009>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to