[issue24546] sequence index bug in random.choice

Tim Peters report at bugs.python.org
Thu Jul 2 07:19:01 CEST 2015


Tim Peters added the comment:

FYI, where x = 1.0 - 2.**-53, I believe it's easy to show this under IEEE double precision arithmetic:

For every finite, normal, double y > 0.0,

    IEEE_multiply(x, y) < y

under the default (nearest/even) rounding mode.  That implies

    int(x*i) < i

for every int i > 0 representable as an IEEE double (including monstrous ints like 123456789 << 300).

Which makes your output _extremely_ surprising, Steven ;-)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24546>
_______________________________________


More information about the Python-bugs-list mailing list