News for hackers. Stuff that matters.
[dead]
Re:Eloquent JavaScript 4th edition (2024) by wk_end on Thursday March 07, 2024 @10:24AM (#39630206)
There's BigInt [0]. Probably less useful for this specific case, but possibly useful as well, are typed integer arrays [1].

[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guid...

Re:Eloquent JavaScript 4th edition (2024) by alyandon on Thursday March 07, 2024 @10:26AM (#39630243)
Ah, very cool. Thanks.
Re:Eloquent JavaScript 4th edition (2024) by throwaway632 on Thursday March 07, 2024 @10:26AM (#39630233)
> handling integer math correctly

JavaScript doesn't have integers. Everything is a float. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Although it has BigInt now.

Re:Eloquent JavaScript 4th edition (2024) by alyandon on Thursday March 07, 2024 @10:47AM (#39630476)
Yes, I'm aware that internally it is using floating point representation and that is one of the main reasons I avoid using it for anything math related. However, I am now aware that BigInt() exists so thanks for the link.