Performing 128 bit math in nodejs
This may work for you:
npm install big.js
It claims to be a small, fast JavaScript library for arbitrary-precision decimal arithmetic.
Try this.
Try
npm install int
and see if that works for you -- it is supposedly handling arbitrary precision integer
documentation here; https://www.npmjs.org/package/int
There is list of similar packages if that specific package does not work for you; https://www.npmjs.org/browse/keyword/bignum
News from the year 2020:
Node.js (version 10.4.0+) supports BigInts, which are arbitrarily large integers.
- They can be created by appending an
n
to a number, or by callingBigInt()
, for example123n
BigInt(123)
- Operators
+, *, -, /, **, %
work as with numbers - Operator
/
truncates the result to an integer - Operators
<<, >>, <<<
work as with numbers - Operator
>>>
does not work -
123n == 123
, but123n !== 123
(they are different types)
For more information see: MDN web docs BigInt