On Wed, Jul 20, 2016 at 3:42 PM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > Arithmetic on integer-values (e.g. 1.0) is always exact, up to a limit of > either 2**53 or approximately 1e53, I forget which. (That's why most > Javascript > programmers fail to notice that they don't have an integer type.)
It's 2**53, because 64-bit floats use a 53-bit mantissa (52-bits stored and an implicit 1 at the beginning, although I can never remember how denormals are represented). Works out to a bit under 1e16. AIUI asm.js offers a 32-bit integer type, which in fall-back mode is represented with the native "Number" type; for values that could be stored in a 32-bit integer, a 64-bit float is perfectly accurate (just stupidly inefficient compared to a real integer type). ChrisA -- https://mail.python.org/mailman/listinfo/python-list