Tim Peters <tim.pet...@gmail.com> added the comment:

Do you realize that 2**54-1 isn't exactly representable as a float?  It
requires 54 bits of precision, but the Python float format only has 53
bits available (on all popular boxes).

>>> 2**54-1
18014398509481983L
>>> float(_)  # rounds to closest representable float
18014398509481984.0

In fact, x//y == x//float(y) for only a small subset of integer x and y
values, mostly because only a small subset of integer x and y values are
exactly representable as floats (given that Python integers enjoy
unbounded precision, but floats only retain 53 bits).

----------
nosy: +tim_one

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

Reply via email to