Chris Kaynor <ckay...@zindagigames.com> writes: > On Thu, Jul 21, 2016 at 4:54 PM, Ben Bacarisse <ben.use...@bsb.me.uk> wrote: > >> Steven D'Aprano <st...@pearwood.info> writes: >> <snip> >> > Or you might be using a language like Javascript, which intentionally has >> > only floats for numbers. That's okay, you can still perform exact integer >> > arithmetic, so long as you stay within the bounds of ±2**16. >> >> Small point: it's 2**52. >> > > If you really want to be picky, it is 2**53, inclusive:
Yes, I mis-typed. Typical, I suppose, for a correction! To add something useful, there are properties Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER which are 2**53 - 1 and -2**53 + 1. These are the largest (and smallest) integers such that i and i+1 (or i and i-1) are exactly representable. <snip> -- Ben. -- https://mail.python.org/mailman/listinfo/python-list