+ 1
How to use 64-bit Integer in Javascript to avoid the overflow?
How to use 64-bit Integer in Javascript to avoid the overflow?
3 Respostas
+ 4
XXX js has types, even if js variables are not typed ^^
anyway, js has no 'long' type... only float numbers (and internally 32 bits signed integer) wich impose integer upper limit at 2^53.
however, modern js have BigInt object, wich could handle arbitrarily large integers:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
... or you could use TypedArray wich provide 64 bits models (float, int, uint) since your browser do support BigInt:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays
+ 2
visph yeah I meant to say that you can't 'specify' types for variables in JavaScript.
And thanks for the additional info though. I didn't know JavaScript has BigInt too. I'll delete my answer because it's wrongđ
0
Use "long" datatype for it