[Interest] JS numbers to qint64
Thiago Macieira
thiago.macieira at intel.com
Wed Jul 12 16:55:28 CEST 2017
On quarta-feira, 12 de julho de 2017 02:53:39 PDT Shantanu Tushar wrote:
> qml: Opening 5762702576189441
> Opening 5762702576189442
>
> As you can see the number changes. What am I doing wrong?
Expecting JS numbers to be precise.
Remember that in JavaScript, numbers are actually double-precision floating
point. They are lossy.
They can represent with fidelity only in the range ±2^53. Yours is inside the
range (only just!) but a simple manipulation of it could throw it outside for
a while.
I recommend staying well away from the limits. Like limiting to 32 bits.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Interest
mailing list