Hacker News new | past | comments | ask | show | jobs | submit login

> It's a bit strange that it got BigInt before Int64

JavaScript has Int64?




Sorry, 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.


Why would it need a 64 bit int? How often do you go over 2*56 in Javascript?


All 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.


As 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: