7

It seems that even the newest Ecmascript 8 has no support for 64bit integers.

Currently we have to use libraries, like Long or UInt64 or Closure Library.

Is it technically possible to add native support for 64bit integers in Javascript?

Timo Kähkönen
  • 11,962
  • 9
  • 71
  • 112
  • 1
    "All" it takes is a specification change.. it is very much "technically possible", although since such 64-bit integer support is still *not* included, then a library (or equivalent transpilation) is still required.. – user2864740 Aug 27 '17 at 19:57

1 Answers1

4

Yes, it is. There's a stage 3 proposal for arbitrary-bigints (including enough to allow implementations to specialize fixed 64-bit use), so it's literally just waiting for implementations and tests at this point. Therefore, one can conclude that it's technically possible.

gsnedders
  • 5,532
  • 2
  • 30
  • 41
  • Seems very promising: "TypedArrays and DataViews BigInts give JavaScript the ability to accurately represent 64-bit signed and unsigned integers: BigUint64Array and BigInt64Array, whose elements read from property access are BigInts DataView.prototype.getBigInt64/getBigUint64, returning a BigInt Similarly, BigInts may be used by the WebAssembly FFI for 64-bit arguments and return values to functions." https://github.com/tc39/proposal-bigint – Timo Kähkönen Aug 27 '17 at 20:06
  • Is it just me, or is BigInt still incredibly slow in Google Chrome? [This benchmark](https://jsbench.me/aljldbe9a9/1) says BigInt's 64-bit operations are 99% slower than an equivalent 32-bit code. This makes it no more suitable than Long.js or another shim library. – bryc Aug 28 '18 at 06:14