This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients Serge Anuchin, mark.dickinson, r.david.murray, rhettinger, serhiy.storchaka, skrah, steven.daprano, tim.peters, vstinner
Date 2015-07-05.07:18:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1436080692.04.0.999718991048.issue24546@psf.upfronthosting.co.za>
In-reply-to
Content
[Tim]
> I suspect, but have not proved, that 1. - 2.**-53 is the only
> random.random() result for which it's possible that double-rounding
> can cause int(i * random.random()) == i.

I'm sure this is true.  Any other random value is at most 1 - 2**-52, and we're always going to have (1 - 2**-52) * i <= next_below(i), (where * represents multiplication in the rationals, with unrounded result), and since next_below(i) is representable both in the extended 64-bit precision and the target 53-bit precision, neither of the roundings will change that inequality.
History
Date User Action Args
2015-07-05 07:18:12mark.dickinsonsetrecipients: + mark.dickinson, tim.peters, rhettinger, vstinner, steven.daprano, r.david.murray, skrah, serhiy.storchaka, Serge Anuchin
2015-07-05 07:18:12mark.dickinsonsetmessageid: <1436080692.04.0.999718991048.issue24546@psf.upfronthosting.co.za>
2015-07-05 07:18:12mark.dickinsonlinkissue24546 messages
2015-07-05 07:18:11mark.dickinsoncreate