# @formatjs/bigdecimal

> BigInt-backed decimal arithmetic for ECMA-402 polyfills

Latest version **0.2.7** (published 2026-07-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @formatjs/bigdecimal
pnpm add @formatjs/bigdecimal
yarn add @formatjs/bigdecimal
bun add @formatjs/bigdecimal
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.2.7 |
| Published | 2026-07-11 |
| First published | 2026-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 53.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | Long Ho <holevietlong@gmail.com> |
| Maintainers | longlho, redonkulus, pyrocat |
| Keywords | bigdecimal, bigint, decimal, ecma402, i18n, intl |

## Links

- npm: https://www.npmjs.com/package/@formatjs/bigdecimal
- Repository: formatjs/formatjs
- Homepage: https://github.com/formatjs/formatjs#readme
- Issues: https://github.com/formatjs/formatjs/issues
- npm.io page: https://npm.io/package/@formatjs/bigdecimal

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 0.2.7 (latest) — 2026-07-11
- 0.2.6 — 2026-06-04
- 0.2.5 — 2026-05-15
- 0.2.4 — 2026-05-12
- 0.2.3 — 2026-05-05
- 0.2.2 — 2026-04-29
- 0.2.1 — 2026-04-13
- 0.2.0 — 2026-03-19
- 0.1.0 — 2026-03-17

## README

# @formatjs/bigdecimal

BigInt-backed decimal arithmetic library designed as a lightweight replacement for `decimal.js` in ECMA-402 polyfills.

## Representation

Values are represented as `mantissa × 10^exponent` where:

- `mantissa` is a `bigint` (signed, normalized — no trailing zeros)
- `exponent` is a `number` (integer scaling factor)
- Special flags handle NaN, ±Infinity, and -0

## API

Implements the 27 methods used by `@formatjs/ecma402-abstract`:

- **Arithmetic**: `times`, `div`, `plus`, `minus`, `mod`, `abs`, `negated`, `pow`, `floor`, `ceil`, `log`
- **Comparison**: `eq`, `lessThan`, `greaterThan`, `lessThanOrEqualTo`, `greaterThanOrEqualTo`
- **Queries**: `isZero`, `isNaN`, `isFinite`, `isNegative`, `isPositive`, `isInteger`
- **Conversion**: `toNumber`, `toString`
- **Static**: `BigDecimal.pow`, `BigDecimal.set`

---
_Source: https://npm.io/package/@formatjs/bigdecimal · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
