npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@evestx/bignumber

v0.0.1

Published

eVESTX Library for work with Bignumber in javascript

Readme

@evestx/bignumber

A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic.

Load

The library is the single JavaScript file bignumber.umd.js (or minified, bignumber.umd.min.js).

Browser:

<script src='./dist/bignumber.umd.min.js'></script>

Node.js:

$ npm install @evestx/bignumber
const { BigNumber } = require('@evestx/bignumber');

ES6 module:

import { BigNumber } from "@evestx/bignumber"

AMD loader libraries such as requireJS:

require(['@evestx/bignumber'], function(BigNumber) {
    // Use BigNumber here in local scope. No global BigNumber.
});

Use

let x = new BigNumber(123.4567);
let y = BigNumber('123456.7e-3');
let z = new BigNumber(x);
x.eq(y) && y.eq(z) && x.eq(z);      // true

To get the string value of a BigNumber use toString() or toFixed(). Using toFixed() prevents exponential notation being returned, no matter how large or small the value.

let x = new BigNumber('1111222233334444555566');
x.toString();                       // "1111222233334444555566"
x.toFixed();                        // "1111222233334444555566"
Clone

Clones an object

const some = new BigNumber(1);
const clone = some.clone();
Add

Performs addition

const bigNum = new BigNumber('100');
const result = bigNum.add('50'); // with method toFixed '150'
Sub

Subtraction

const bigNum = new BigNumber('100');
const result = bigNum.sub('50'); // with method toFixed '50'
Mul

Multiplication

const bigNum = new BigNumber('100');
const result = bigNum.mul(2); // with method toFixed '200'
Div

Division

const bigNum = new BigNumber('100');
const result = bigNum.div(2); //  with method toFixed '50'
Pow

Exponentiation

const bigNum = new BigNumber('100');
const result = bigNum.pow(2); // with method toFixed '10000'
Sqrt

Square root

const bigNum = new BigNumber('100');
const result = bigNum.sqrt(); // with method toFixed '10'
Abs

Module

const bigNum = new BigNumber('-100');
const result = bigNum.abs(); // with method toFixed 100
Mod

Remainder of the division

const bigNum = new BigNumber('100');
const result = bigNum.mod(10); // with method toFixed '0' 
RoundTo

Rounds up. Accepts number of decimal places after rounding and rounding mode see here: http://mikemcl.github.io/bignumber.js/#constructor-properties

const bigNum = new BigNumber('100');
const result = bigNum.roundTo(); //
Eq

Equality

const bigNum = new BigNumber('100');
const result = bigNum.eq(100); // true
Lt

Less

const bigNum = new BigNumber('100');
const result = bigNum.lt(); //
Gt

More

const bigNum = new BigNumber('100');
const result = bigNum.gt(); //
Lte

Less than or equal to

const bigNum = new BigNumber('100');
const result = bigNum.lte(); //
Gte

More or equal

const bigNum = new BigNumber('100');
const result = bigNum.gte(); //
IsNaN

Checks for NaN

const bigNum = new BigNumber('100');
const result = bigNum.isNaN(); // false
IsFinite

Checks for Infinity (positive and negative)

const bigNum = new BigNumber('100');
const result = bigNum.isFinite(); //
IsZero

Checks for null

const bigNum = new BigNumber('100');
const result = bigNum.isZero(); // false
IsPositive

Above zero

const bigNum = new BigNumber('100');
const result = bigNum.isPositive(); // true
IsNegative

Less than zero

const bigNum = new BigNumber('100');
const result = bigNum.isNegative(); // false
IsInt

Checks if an integer

const bigNum = new BigNumber('100');
const result = bigNum.isInt(); //
GetDecimalsCount

We get the number of zanks after the decimal point of the number

const bigNum = new BigNumber('100');
const result = bigNum.getDecimalsCount(); // 0
IsEven

Even

const bigNum = new BigNumber('100');
const result = bigNum.isEven(); // true
IsOdd

not even

const bigNum = new BigNumber('100');
const result = bigNum.isOdd(); // false
ToBytes

Convert the number to signed bytes (8 bytes). Works only with integers.

const bigNum = new BigNumber('100');
const result = bigNum.toBytes();
ToFormat

We output the number in the string equivalent of c, taking into account the formatting settings. Optionally accepts the number of rounding characters, rounding mode (as in roundTo), and output format settings.

const bigNum = new BigNumber('1000000.12312');
bigNum.toFormat(); // 1,000,000.12312 
bigNum.toFormat(2); // 1,000,000.12 
bigNum.toFormat(2); // 1,000,000.12 
bigNum.toFormat(2, 0); // 1,000,000.13 
bigNum.toFormat(2, 0, { groupSeparator: ' ' }); // 1 000 000.13 
ToFixed

Output the number in string equivalent. Optionally accepts the number of rounding characters and the rounding mode (as in roundTo)

const bigNum = new BigNumber('100');
const result = bigNum.toFixed(); //
ToNumber

Leads to number

const bigNum = new BigNumber('100');
const result = bigNum.toNumber(); //

Static Methods

fromBytes

Outputs a signed number from bytes. Only works with 8 bytes.

const some = BigNumber.fromBytes(Uint8Array.from([1,2,3,4,5,6,7,8]));
max

Takes any number of arguments, chooses the largest number from the arguments

BigNumber.max(1, '2', new BigNumber(4)); // with method toFixed '4'
min

Takes any number of arguments, chooses the smallest number of arguments

BigNumber.min(1, '2', new BigNumber(4)); // with method toFixed '1'
sum

Takes any number of arguments, adds numbers

BigNumber.min(1, '2', new BigNumber(4)); //with method toFixed '7'