# MikeMcl/decimal.js

An arbitrary-precision Decimal type for JavaScript

Repository: https://github.com/MikeMcl/decimal.js
Canonical: https://ross.abutalabs.com/products/decimaljs
Homepage: http://mikemcl.github.io/decimal.js
Language: JavaScript
License: MIT
License Family: permissive
Topics: javascript, bignumber, arbitrary-precision, significant-digits, trigonometric-functions, bigdecimal
Last push: 2026-07-13T23:00:16+00:00

## Health v2 (maintenance only)
Score: 74/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 92, release rhythm 35, longevity 100
- inputs: {"age_days": 4536, "days_push": 51, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 7249, forks 496 (observed 2026-08-28T04:09:57.829544+00:00)

## What it is
decimal.js is an arbitrary-precision Decimal type for JavaScript, supporting integers and floats with configurable significant-digit precision. It replicates many Number and Math methods, adds trigonometric functions and non-integer powers, and has no dependencies.

## Use cases
- do precise decimal arithmetic for money without floating-point errors
- compute with very large or very small numbers in JavaScript
- calculate trig functions at high precision
- round numbers to a fixed number of significant digits
- parse and format numbers in hex, binary, or octal
- replace Java BigDecimal in a JavaScript port

## When to choose
- you need significant-digit precision and rounding on all operations
- you need trigonometric functions, logs, or non-integer powers with arbitrary precision
- you want a dependency-free library with wide browser and Node compatibility
- you need TypeScript declarations

## When to avoid
- you only need decimal-place rounding and a smaller bundle (use bignumber.js or big.js)
- you need integer-only arithmetic (use BigInt)
- you need a lighter version without trig functions (use decimal.js-light)

## Facets
- artifact type: library
- maturity: stable
- function: math, serialization
- domain: developer-tools, web-development, mathematics
- platform: browser, cross-platform
- tags: arbitrary-precision, decimal-arithmetic, bignumber, floating-point, typescript-definitions, nodejs

## Member repositories
- MikeMcl/decimal.js (main) score 74

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:57.829544+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:39:43.921845+00:00, confidence not recorded.
  - readme: https://github.com/MikeMcl/decimal.js (fetched 2026-08-28T04:09:57.829544+00:00, sha 3684d514352e)
  - homepage: http://mikemcl.github.io/decimal.js (fetched 2026-08-29T08:34:39.422646+00:00, sha 5596ac61dba3)
  - registry_npm: https://registry.npmjs.org/decimal.js (fetched 2026-08-29T08:34:39.433621+00:00, sha 85f419bc61a1)
- Data as of 2026-08-30T08:39:29.467469+00:00.
