4 ms·
> It's a bit strange that it got BigInt before Int64 JavaScript has Int64?
by ebingdom 4y ago
> It's a bit strange that it got BigInt before Int64
JavaScript has Int64?
- jsheard 4y agoSorry, no it doesn't. I meant there should be an Int64 type and it probably should have been implemented before they dived into arbitrary precision integers. I suppose the answer if you really care about performance is "just use WebAssembly" since that does have native 64 bit integers.
- tgv 4y agoWhy would it need a 64 bit int? How often do you go over 2*56 in Javascript?
- Asraelite 4y agoAs a pure quantity representing a real-world value, probably not very often, but just as a series of bits or a more abstract quantity like a memory address, it will often go above 2^56. Many algorithms and binary file encodings use 64 bit integers so interfacing with them in Javascript is hard.
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- drfuchs 4y agoAll sorts of hash functions expect 64-bit intermediate values. Worse, these algorithms are liable to go haywire, and return very-not-randomized results if intermediate values are silently truncated to 56 bits (or magically become floating-point and thus lose their lower-order one bits) as happens when they're naively translated from C to JS.
- JeremyBanks 4y ago