This library is based on java.math.BigInteger Dependency Long
$ npm install node-biginteger
var BigInteger = require('node-biginteger');
var n = BigInteger.fromString('abc', 16);
n.toString(16);
- val Long
- Return: BigInteger
- val String
- radix int,Optional, Default: 10
- Return: BigInteger
- signum int, 1,0,-1
- magnitude Array
- Return: BigInteger
- Return: Buffer
- Return: String
- Return: BigInteger
- Return: BigInteger
- Return: Long
- val BigInteger
- Return: BigInteger
- val BigInteger
- Return: BigInteger
- val BigInteger
- Return: BigInteger
- val BigInteger
- Return: BigInteger
- val BigInteger
- Return: BigInteger
- Return: BigInteger
- exponent int
- Return: BigInteger
var n = BigInteger.fromString('2', 10);
var n1 = n.pow(2);
console.log(n1.toString());
// 4
- val BigInteger
- Return: BigInteger
n.remainder(val)
- val BigInteger
- Return: BigInteger
$ node beanchmark.js
BigInteger#multiply x 68,912 ops/sec ±0.50% (100 runs sampled)
bignum#mul x 40,709 ops/sec ±1.30% (90 runs sampled)
BigInteger#modPow(long) x 79.62 ops/sec ±0.98% (71 runs sampled)
bignum#powm(long) x 22,901 ops/sec ±2.43% (92 runs sampled)
BigInteger#modPow(short) x 134,965 ops/sec ±1.19% (97 runs sampled)
bignum#powm(short) x 55,922 ops/sec ±2.84% (91 runs sampled)
MIT