huge-num

1.3.3 • Public • Published

Huge Numbers

A npm package to apply math 🔢 operations on huge numbers (unlimited length 😉)

Version Downloads License Coverage Status

Features:

  • Numbers size limit:
    • unlimited
  • Math operators:
    • Sum (+)
    • Multiply (×)

Usage:

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

Documentation:

Contributors

To contribute, just fork the project, make some changes, and submit a pull request.

License

This project is public domain. For more details, read about the Unlicense.

Developer:

Package Sidebar

Install

npm i huge-num

Weekly Downloads

1

Version

1.3.3

License

ISC

Unpacked Size

8.91 kB

Total Files

13

Last publish

Collaborators

  • em_it