decimal.js is a JavaScript library that provides an arbitrary-precision decimal data type designed to overcome the limitations of native floating-point arithmetic in JavaScript. It allows developers to perform accurate calculations with numbers of virtually unlimited precision, making it especially useful for financial, scientific, and high-precision applications. Unlike standard JavaScript numbers, which can produce rounding errors due to binary representation, decimal.js ensures consistent and predictable results by operating on decimal values directly. The library defines a Decimal constructor that accepts numbers, strings, or existing Decimal instances, enabling flexible usage across different input types. It supports a wide range of mathematical operations, including arithmetic, logarithmic, trigonometric, and exponential functions, making it significantly more comprehensive than simpler numeric libraries.

Features

  • Arbitrary-precision decimal arithmetic for accurate calculations
  • Configurable precision using significant digits
  • Support for advanced math functions including trigonometry and logarithms
  • Flexible input handling with numbers, strings, and Decimal instances
  • Consistent rounding behavior across all operations
  • Lightweight single-file or module-based integration

Project Samples

Project Activity

See All Activity >

Categories

Libraries

License

MIT License

Follow decimal.js

decimal.js Web Site

Other Useful Business Software
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of decimal.js!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Libraries

Registered

2026-03-20