🌐
GitHub
github.com › MikeMcl › decimal.js
GitHub - MikeMcl/decimal.js: An arbitrary-precision Decimal type for JavaScript · GitHub
... The library is similar to bignumber.js, but here precision is specified in terms of significant digits rather than decimal places, and all calculations are rounded to the precision (similar to Python's decimal module) rather than just those ...
Starred by 7.2K users
Forked by 494 users
Languages   JavaScript
🌐
GitHub
github.com › tc39 › proposal-decimal
GitHub - tc39/proposal-decimal: Built-in exact decimal numbers for JavaScript · GitHub
decimal128.js is an npm package that implements Decimal128 in JavaScript (more precisely, the variant of Decimal128 that we envision for this proposal) We are looking for volunteers for writing a polyfill along the lines of JSBI for both alternatives, see #17
Starred by 608 users
Forked by 18 users
Languages   HTML
🌐
GitHub
github.com › MikeMcl › decimal.js-light
GitHub - MikeMcl/decimal.js-light: The light version of decimal.js, an arbitrary-precision Decimal type for JavaScript. · GitHub
The light version of decimal.js, an arbitrary-precision Decimal type for JavaScript. - MikeMcl/decimal.js-light
Starred by 406 users
Forked by 49 users
Languages   JavaScript 99.8% | HTML 0.2%
🌐
npm
npmjs.com › package › decimal.js
decimal.js - npm
npm i decimal.js · github.com/MikeMcl/decimal.js · github.com/MikeMcl/decimal.js#readme · 48,032,832 · 10.6.0 · MIT · 284 kB · 6 · 8 months ago · mikemcl · Analyze security with SocketCheck bundle sizeView package healthExplore ...
      » npm install decimal.js
    
Published   Jul 06, 2025
Version   10.6.0
Author   Michael Mclaughlin
🌐
GitHub
github.com › MikeMcl › big.js › issues › 45
big.js vs. bignumber.js vs. decimal.js? · Issue #45 · MikeMcl/big.js
February 17, 2015 - There was an error while loading. Please reload this page · Suggestion: describe in the readme how these three libraries differ. AFAICT, big.js only supports base 10, whereas bignumber.js supports arbitrary bases. But what distinguishes decimal.js from big.js
Author   rauschma
🌐
Mikemcl
mikemcl.github.io › decimal.js
decimal.js API
An arbitrary-precision Decimal type for JavaScript. Hosted on GitHub.
🌐
npm Trends
npmtrends.com › big.js-vs-bignumber.js-vs-decimal.js-vs-mathjs
big.js vs bignumber.js vs decimal.js vs mathjs | npm trends
Comparing trends for big.js 7.0.1 ... vs. decimal.js 10.6.0 which has 34,483,615 weekly downloads and 7,114 GitHub stars vs. mathjs 15.1.0 which has 1,869,274 weekly downloads and 14,984 GitHub stars....
🌐
GitHub
github.com › Agrora › decimal-js
GitHub - Agrora/decimal-js: DecimalJS is an arbitrary precision floating point arithmetic library based on PHP's bcmath extension. · GitHub
// Pull project git clone https://github.com/Agrora/decimal-js // Enter project directory cd decimal-js // Install development dependencies npm install // ... make your changes ...
Author   Agrora
🌐
GitHub
github.com › MikeMcl › big.js
GitHub - MikeMcl/big.js: A small, fast JavaScript library for arbitrary-precision decimal arithmetic. · GitHub
A small, fast JavaScript library for arbitrary-precision decimal arithmetic. ... The little sister to bignumber.js and decimal.js.
Starred by 5.2K users
Forked by 418 users
Languages   JavaScript 98.6% | HTML 1.3% | Java 0.1%
🌐
GitHub
github.com › MikeMcl › decimal.js › blob › master › decimal.d.ts
decimal.js/decimal.d.ts at master · MikeMcl/decimal.js
// Documentation: http://mikemcl.github.io/decimal.js/ // // Exports: // // class Decimal (default export) // type Decimal.Constructor · // type Decimal.Instance · // type Decimal.Modulo · // type Decimal.Rounding · // type Decimal.Value · // interface Decimal.Config · // // Example (alternative syntax commented-out): // // import {Decimal} from "decimal.js" // //import Decimal from "decimal.js" // // let r: Decimal.Rounding = Decimal.ROUND_UP; // let c: Decimal.Configuration = {precision: 4, rounding: r}; // Decimal.set(c); // let v: Decimal.Value = '12345.6789'; // let d: Decimal = new Decimal(v); // //let d: Decimal.Instance = new Decimal(v); // // The use of compiler option `--strictNullChecks` is recommended.
Author   MikeMcl
Find elsewhere
🌐
NPM Compare
npm-compare.com › big.js,bignumber.js,decimal.js,decimal.js-light
decimal.js vs bignumber.js vs big.js vs decimal.js-light | JavaScript Arbitrary-Precision Decimal Libraries
While bignumber.js is a robust choice for handling large numbers, there are several alternatives in the JavaScript ecosystem that also provide similar functionalities. Here are a few notable ones: big.js is a lightweight library for arbitrary-precision decimal arithmetic.
🌐
npm Trends
npmtrends.com › big.js-vs-bigdecimal-vs-bignumber.js-vs-decimal.js-vs-mathjs
big.js vs bigdecimal vs bignumber.js vs decimal.js vs mathjs | npm trends
Comparing trends for big.js 7.0.1 ... vs. decimal.js 10.6.0 which has 42,295,481 weekly downloads and 7,140 GitHub stars vs. mathjs 15.1.1 which has 2,057,021 weekly downloads and 15,002 GitHub stars....
🌐
Best of JS
bestofjs.org › projects › bigjs
Best of JS • Big.js
A small, fast JavaScript library for arbitrary-precision decimal arithmetic. Math · MikeMcl/big.jsmikemcl.github.io/big.jsbig.js · Loading data... README · Loading README.md ·
🌐
DEV Community
dev.to › fvictorio › a-comparison-of-bignumber-libraries-in-javascript-2gc5
A comparison of BigNumber libraries in JavaScript - DEV Community
November 28, 2020 - Finally I'll give you my advice on which one to use (spoiler alert: it's big.js). The following table shows the libraries I picked and some aspects of each one. There are a lot of other things you might want to consider, like their API, performance, supported operations, etc., but this should give you a place to start. All of them support integer values, but decimal.js, by design, can lose precision (more on this later).
🌐
GitHub
github.com › mikemcl › big.js › wiki
Home · MikeMcl/big.js Wiki · GitHub
For example, it does not have the limitation of bignumber.js that when adding a value with a small exponent to one with a large exponent, bignumber.js will attempt to perform the operation to full precision, which may make the time taken for the operation unviable. As mentioned above, decimal.js also supports non-integer powers and adds the trigonometric functions and exp, ln, and log methods.
Author   MikeMcl
🌐
MeasureThat
measurethat.net › Benchmarks › Show › 12367 › 0 › bignumberjs-vs-bigjs-vs-decimaljs-i
Benchmark: bignumber.js vs. big.js vs. decimal.js (I) - MeasureThat.net
Native.toFixed() vs bignumber.js vs big.js vs decimal.js · bignumber.js vs. big.js vs. [email protected] (I) Comments · × · Do you really want to delete benchmark? Cancel Delete · × · FAQ: FAQ · Source code: GitHub/MeasureThat.net · Report issues: MeasureThat.net/Issues ·
🌐
npm Trends
npmtrends.com › bignumber.js-vs-decimal.js-vs-mathjs-vs-numeral-vs-numeraljs
bignumber.js vs decimal.js vs mathjs vs numeral vs numeraljs | npm trends
Comparing trends for bignumber.js 9.3.1 which has 14,488,094 weekly downloads and 6,960 GitHub stars vs. decimal.js 10.6.0 which has 18,051,401 weekly downloads and 7,092 GitHub stars vs. mathjs 15.1.0 which has 799,866 weekly downloads and 14,971 GitHub stars vs. numeral 2.0.6 which has 803,231 weekly downloads and 9,731 GitHub stars vs. numeraljs 1.5.6 which has 1,775 weekly downloads and 1 GitHub stars.
🌐
GitHub
github.com › MikeMcl › decimal.js › blob › master › decimal.mjs
decimal.js/decimal.mjs at master · MikeMcl/decimal.js
An arbitrary-precision Decimal type for JavaScript - decimal.js/decimal.mjs at master · MikeMcl/decimal.js
Author   MikeMcl
🌐
Reddit
reddit.com › r/node › best package for money arithmetic?
r/node on Reddit: Best Package for Money Arithmetic?
March 7, 2017 -

Hey Node Friends. I'm going to have to build a system that deals with currency and money arithmetic for the first time. We are all aware that using floating points is problematic for these sort of calculations.

Is there a preferred library by the community that deals with this stuff?

The best I've found on my own is big.js

Update: Unlike the comments below, I didn't use float or integers as that is what I was trying not to use in the first place.

mathjs was a suggestion, but that depends on decimal.js anyway so you could just use decimal.js directly.

I read over this comparison between decimal.js, big.js and bignumber.js. I went with big.js in the end, just because it's the more minimal version of the 3 that does everything I need (ex. I only need to use base 10)

Thanks for the help!