Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 16, 2024 via pnpm

big.js 6.2.1

A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic
Package summary
Share
0
issues
1
license
1
MIT
Package created
13 May 2013
Version published
9 Jul 2022
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
big.js@6.2.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of big.js 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does big.js do?

Big.js is a small yet powerful JavaScript library for arbitrary-precision decimal arithmetic. It offers a simple API and is faster and easier-to-use than Java's BigDecimal JavaScript versions. Boasting a size of just 6 KB when minified, it replicates the toExponential, toFixed, and toPrecision methods of JavaScript numbers. This library is designed for those who require precise arithmetic operations and value storage in a decimal floating point format.

How do you use big.js?

To use the Big.js library, it needs to be installed first. If you're using a browser, you can add Big.js to the global scope using a script tag. Alternatively, you can import it as an ES module. If you're using Node.js, the library can be installed using npm and required in your script.

For simple usage, create a Big number from a primitive number, string, or another Big number. Here is an example:

const Big = require('big.js');
let x = new Big(123.4567);
let y = Big('123456.7e-3'); // 'new' is optional
let z = new Big(x);
console.log(x.eq(y) && x.eq(z) && y.eq(z)); // true

The methods that return a Big number can be chained. Like so:

let result = x.div(y).plus(z).times(9).minus('1.234567801234567e+8').plus(976.54321).div('2598.11772');

Additionally, you can invoke toExponential, toFixed and toPrecision methods on your Big number:

x = new Big(255.5);
console.log(x.toExponential(5)); // "2.55500e+2"
console.log(x.toFixed(5)); // "255.50000"
console.log(x.toPrecision(5)); // "255.50"

Where are the big.js docs?

You can find the comprehensive documentation for Big.js on GitHub. This includes a detailed guide and a list of method descriptions and their usage, beneficial for developers of all levels to understand the intricacies of this library.