BigInteger

Introduced in 4.3.0

Stability: 2 - Stable

const BigInteger = require('kado/lib/BigInteger')

The BigInteger library implements methods to handle very large numbers

Class: BigInteger

BigInteger is the main interface

BigInteger.constructor(a, b, c)

BigInteger.newByValue(v)

BigInteger.clone()

Coercion Operations

BigInteger.intValue()

BigInteger.byteValue()

BigInteger.shortValue()

BigInteger.toByteArray()

BigInteger.toString(radix)

Comparison Operations

BigInteger.compareTo(a)

BigInteger.equals(a)

BigInteger.min(a)

BigInteger.max(a)

Bitwise Operations

BigInteger.not()

BigInteger.and(a)

BigInteger.andNot(a)

BigInteger.or(a)

BigInteger.xor(a)

BigInteger.shiftLeft(n)

BigInteger.shiftRight(n)

BigInteger.getLowestSetBit()

BigInteger.bitCount()

BigInteger.bitLength()

BigInteger.testBit(n)

BigInteger.setBit(n)

BigInteger.clearBit(n)

BigInteger.flipBit(n)

Arithmetic Operations

BigInteger.add(a)

BigInteger.subtract(a)

BigInteger.multiply(a)

BigInteger.divide(a)

BigInteger.remainder(a)

BigInteger.divideAndRemainder(a)

BigInteger.mod(a)

BigInteger.modPow(e, m)

BigInteger.modPowInt(e, m)

BigInteger.modInverse(m)

BigInteger.pow(e)

BigInteger.square()

BigInteger.gcd(a)

BigInteger.negate()

BigInteger.abs()

BigInteger.signum()

BigInteger.isProbablePrime(t)


BigInteger interfaces not implemented in jsbn:

  • BigInteger(int signum, byte[] magnitude)
  • double doubleValue()
  • float floatValue()
  • int hashCode()
  • long longValue()
  • static BigInteger valueOf(long val)