4 ms·
Someone asked about integer support in JavaScript. JS now supports BigInt! >2**57 144115188075855870 >2n**57n 144115188075855872n
by z3t4 3y ago
Someone asked about integer support in JavaScript. JS now supports BigInt!
>2**57
144115188075855870
>2n**57n
144115188075855872n
- ethagnawl 3y agoThat's news to me! https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- alyandon 3y agoYes, I was asking about that and I'm very happy to see this exists now.
- williamstein 3y agoAnd in some JavaScript engines (eg V8) bigint multiplication is asymptotically fast, unlike say the default CPython. It’s a very pleasant surprise if you happen to be a number theorist (say).
- csjh 3y agoHow do you mean? CPython uses karatsuba's for large numbers which should be asymptotically fast https://github.com/python/cpython/blob/d864b0094f9875c5613cbb0b7f7f3ca8f1c6b606/Objects/longobject.c#L3816 https://github.com/python/cpython/blob/d864b0094f9875c5613cb...
- bovermyer 3y agoOh thank god. I've been having to do some hacky things to represent numbers on an astronomical scale for my star system/planet generators.
- deleted 3y ago[deleted]