3 ms·
I just had to look this up, the limitation is that JS has a max int of 2^53? Do you know what the reasons were for JS not implementing full 2^64? Also I notic
by bogomipz 10y ago
I just had to look this up, the limitation is that JS has a max int of 2^53?
Do you know what the reasons were for JS not implementing full 2^64?
Also I noticed theres a JS C-types that has 64 bit ints, would that not help here?
- anewhnaccount 10y agoAll numbers in Javascript are IEEE 754 64-bit double precision floating point numbers. The significand precision is 53 bits (see here https://en.wikipedia.org/wiki/Double-precision_floating-point_format https://en.wikipedia.org/wiki/Double-precision_floating-poin...).
- bogomipz 10y agoThanks for the clarifications.
- sjrd 10y agoRe ctypes, I assume you are talking about https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes. On that page you can read: > js-ctypes is only available from chrome code; that is, ctypes is not available to websites, only application and extension code. Basically `js-ctypes` won't work in an actual browser. So you cannot use it. There are other Node.js-specific native packages that give a representation for 64-bit integers, but not arithmetic operations. Besides, even if they had arithmetic operations, they would be heap-allocated, and since the JIT cannot understand them, it would not be able to optimize them as well as what we built for Scala.js.