Solidity Big Number

A while back, I have implemented a package supporting unlimited-size computations in Solidity.

This package consists of the following libraries:

  • NaturalNum - a set of functions over natural numbers
  • RationalNum - a set of functions over rational numbers

NaturalNum handles the size-limit internally, thus allowing to rearrange any computation and achieve maximum accuracy without reducing the size of valid input range.

RationalNum maintains the entire expression as a rational number, thus allowing to avoid the rearrangement and implement the computation in its "native form".

Using the latter will typically be less cost-effective, hence it is advisable to use the former whenever performance is considered critical.

This package is available on GitHub as well as on npm.

I hope you find it useful :slight_smile: