<div dir="ltr">The loop runs to completion for me on openSUSE Tumbleweed and both Python 2.7 64bits and Python 3.4 64bits.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 2, 2015 at 4:52 PM, Steven D'Aprano <span dir="ltr"><<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Despite the title, this is not one of the usual "Why can't Python do<br>
maths?" "bug" reports.<br>
<br>
Can anyone reproduce this behaviour? If so, please reply with the version of<br>
Python and your operating system. Printing sys.version will probably do.<br>
<br>
<br>
x = 1 - 1/2**53<br>
assert x == 0.9999999999999999<br>
for i in range(1, 1000000):<br>
    if int(i*x) == i:<br>
        print(i); break<br>
<br>
<br>
Using Jython and IronPython, the loop runs to completion. That is the<br>
correct behaviour, or so I am lead to believe. Using Python 2.6, 2.7 and<br>
3.3 on Centos and Debian, it prints 2049 and breaks. That should not<br>
happen. If you can reproduce that (for any value of i, not necessarily<br>
2049), please reply.<br>
<br>
See also <a href="http://bugs.python.org/issue24546" rel="noreferrer" target="_blank">http://bugs.python.org/issue24546</a> for more details.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Steven<br>
<br>
--<br>
<a href="https://mail.python.org/mailman/listinfo/python-list" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br></div>