-2

Suppose I have a string of a non-decimal representation of a number beyond Number.MAX_SAFE_INTEGER. How would I get a BigInt of that number?
Were the string a representation of a decimal number, I'd just have BigInt(string), but the number is represented non-decimally.
Note: for my application, efficiency matters.
Edit: I'm looking for a general technique that works for arbitrary bases.

chazsolo
  • 7,873
  • 1
  • 20
  • 44

1 Answers1

0

You could try one of the npm packages for large numbers, such as this:

npm big number

Steven Stark
  • 1,249
  • 11
  • 19