I'm looking for a Mathematical solution that deals with really (long, big, huge, storms) numbers. I haven't found anything yet, But I don't wanna think that this problem hasn't be solve at this time. I'm looking for an easy Number solution, like Microsoft Excel Precision (30 decimals), or a BigInteger (Java) solution. in Javascript of course.
To store large numbers in JavaScript, use BigInt() rather than + operator.
ceil() The Math. ceil() function always rounds a number up to the next largest integer.
A BigInt value, also sometimes just called a BigInt, is a bigint primitive, created by appending n to the end of an integer literal, or by calling the BigInt() function (without the new operator) and giving it an integer value or string value.
The equivalent of Java long in the context of MySQL variables is BigInt. In Java, the long datatype takes 8 bytes while BigInt also takes the same number of bytes.
While looking for an big integer library for an ElGamal crypto implementation I tested several libraries with the following results:
I recommend this one: Tom Wu's jsbn.js (http://www-cs-students.stanford.edu/~tjw/jsbn/)
Leemon Baird's big integer library (http://www.leemon.com/crypto/BigInt.js)
bignumber.js (https://github.com/MikeMcl/bignumber.js)
Scheme arithmetic library for JavaScript (https://github.com/jtobey/javascript-bignum)
I haven't tested this by myself: BigNumber (http://jsfromhell.com/classes/bignumber)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With