I'm looking for a bignum library for Javascript. Necessary features:

  • Ability to manipulate integers from, say, -101000 to 101000 or better
  • Addition, subtraction, multiplication, division, modulus, exponentiation, modular exponentiation
  • Conversion between bignums, native numbers, and native strings

Important features:

  • Fast operations -- at least Karatsuba multiplication/division
  • Number theory support -- gcd, lcm, primality testing
  • Readable syntax
  • Support for exact fractions and relevant operations
  • Linear algebra -- matrix multiplication/exponentiation, modular matrix multiplication/exponentiation, matrix solution/inversion, dot product

Nice to have:

  • Small size in kB
  • Support for transcendental operations (sin, cos, tan, exp, etc.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.