A npm package to apply math🔢 operations on huge numbers
A npm package to apply math 🔢 operations on huge numbers (unlimited length 😉)
HugeNum can be used in node.js
Install HugeNum using npm:
npm install huge-num
Then you can define a huge number using a string
import HugeNum from 'huge-num';
const NUMBER_1 = "12213345674890";
const NUMBER_2 = "564564574982348";
let n1 = HugeNum(NUMBER_1);
let n2 = HugeNum(NUMBER_2);
Then you can use the operators on a huge number
huge_number_1.sum(huge_number_2)
const summation = n1.sum(NUMBER_2);
console.log(NUMBER_1 + ' + ' + NUMBER_2 + '=', summation);
// result -> 12213345674890 + 564564574982348= 576777920657238
huge_number_1.multiply(huge_number_2)
const multiply = n1.multiply(NUMBER_2);
console.log(NUMBER_1 + ' *+* ' + NUMBER_2 + '=', multiply);
// result -> 12213345674890 * 564564574982348= 6895222310056771043896841720
To contribute, just fork the project, make some changes, and submit a pull request.
This project is public domain. For more details, read about the Unlicense.