Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

big.js

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

big.js

A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic

  • 6.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
21M
decreased by-1.4%
Maintainers
1
Weekly downloads
 
Created

What is big.js?

The big.js npm package is a library for arbitrary-precision decimal arithmetic. It allows you to perform calculations on numbers with a large number of digits without losing precision, which is a common issue with JavaScript's native Number type.

What are big.js's main functionalities?

Arithmetic Operations

Perform precise addition, subtraction, multiplication, and division operations.

{"addition": "new Big('0.1').plus(new Big('0.2')).toString()", "subtraction": "new Big('0.3').minus(new Big('0.1')).toString()", "multiplication": "new Big('0.2').times(new Big('0.3')).toString()", "division": "new Big('0.3').div(new Big('0.2')).toString()"}

Comparison Operations

Compare two Big numbers to determine equality, or whether one is greater than or less than the other.

{"equals": "new Big('1.0').eq(new Big('1.00'))", "greaterThan": "new Big('2').gt(new Big('1.9999'))", "lessThan": "new Big('0.1').lt(new Big('0.2'))"}

Rounding

Round Big numbers to a specified number of decimal places, or convert a Big number to a fixed-point notation string.

{"round": "new Big('0.12345').round(2).toString()", "toFixed": "new Big('0.12345').toFixed(2)"}

Configuration

Configure the number of decimal places for rounding and the rounding mode (e.g., round half up, round down, etc.).

{"setDP": "Big.DP = 10", "setRM": "Big.RM = 1"}

Other packages similar to big.js

Keywords

FAQs

Package last updated on 10 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc