# Math.js: 5.8 out of 10

Reasonable, with limits. 5th of 8 in [Numbers and money](https://elestia.ai/opensource/numbers/index.md).

Math.js is a large, mature general math library. It has an expression parser, matrices, units, fractions and BigNumber support built on decimal.js. It works for exact decimal math, but for plain money and decimal arithmetic it is heavier and less direct than decimal.js, bignumber.js or Dinero.js. Pick it when you also need its broader math features.

**Best for:** Apps that need user-entered formulas, units, matrices or fractions alongside some exact decimal math.

## Scores

- **Overall: 5.8** (likely 4.8 to 6.9)
  - Claude Opus 5.5 (5.0): It is a strong general math library but not the best choice for exact decimals and money. decimal.js or bignumber.js do that job with a smaller, simpler and safer surface, and Dinero.js handles currency. Recommend it only when you also need formulas, units or matrices. Below-median growth and recurring parser advisories also hold it back.
  - GPT-6.2 Sol (6.6): Math.js is a good choice when a new app needs high-precision decimals inside a broader formula engine. For decimal arithmetic alone, decimal.js supplies the same underlying engine with zero dependencies. Dinero.js is a better fit for currency-aware amounts and allocation, and Intl.NumberFormat handles localized display. The slower release cadence and below-baseline download growth lower the general recommendation, while projects that use several Math.js features can justify a higher score.
- **Needed by many: 4.8** (likely 3.7 to 5.9)
  - Claude Opus 5.5 (5.0): Exact decimal math is a common need in apps that handle money. Math.js serves it, but as a general math toolkit. Most people who need decimals only want a small Decimal type, so its full form fits a narrower group: apps that need formulas, units or matrices.
  - GPT-6.2 Sol (4.5): Precise decimal arithmetic matters in finance, commerce, and numerical applications, and Math.js works in browsers and Node.js. Its broader API mainly earns its place when an app also needs formulas or multiple numeric types. Built-in Intl.NumberFormat covers many display-only needs, and the survey measures work domains rather than demand for Math.js.
- **Helps a lot: 6.6** (likely 5.5 to 7.6)
  - Claude Opus 5.5 (6.0): As a general math library it is excellent, with good types and docs. For this category's job it is decent but indirect. BigNumber support comes from decimal.js and is switched on through global config. It has no money type or currency formatting, and the bundle is large. Dedicated peers do exact decimals and money more simply.
  - GPT-6.2 Sol (7.1): Version 15.2.0 combines configurable decimal precision, exact fractions, and several numeric display formats. Its documentation gives clear examples, but callers and coding agents must opt into BigNumber, tune comparison tolerances, and handle the parser's broad return type. Currency handling takes application code, and a user reported incorrect engineering notation for very large BigNumbers. Independent parser timings cover a narrow workload, leaving performance across decimal workloads less certain.
- **Holds up over time: 6.9** (likely 5.3 to 8.0)
  - Claude Opus 5.5 (7.0): The project has been maintained for 13 years. It saw 62 commits in the last year and pushes as recent as today, and the Scorecard Maintained check is 9. But only two npm versions shipped in the last year, the newest in April 2026, and most of the work rests on one maintainer funded by sponsorships. It has 98 open PRs. Breaking majors like v15 are well documented.
  - GPT-6.2 Sol (6.8): Math.js recorded 62 commits in the last year, and multiple contributors have fixes lined up in the changelog. Only two npm versions shipped in that window, with the latest in April, and version 15 changed percentage parsing. Recent publishing is concentrated in one visible account, and public sponsorship details leave long-term funding unclear.
- **Used widely: 5.6** (likely 4.5 to 6.7)
  - Claude Opus 5.5 (6.0): It has 22M downloads per 4 weeks and about 15k dependent repos, both large in absolute terms. The download ratio of 3.4 is below the 4.1 median, so it is losing share. In this category, decimal.js, bignumber.js and big.js have 25 to 80 times more dependent repos.
  - GPT-6.2 Sol (5.2): ecosyste.ms found about 15,300 dependent repos and 1,900 packages, far fewer repos than for the dedicated decimal peers and more than for Dinero.js. Four-week downloads rose from 6.5 million to 22.2 million, but 3.40× growth trails the 4.10× catalog baseline and decimal.js at 4.41×, suggesting a loss of relative ground. The 15,100 stars cover the whole math toolkit, and the one Bluesky post was about seeded randomness. CDN use and automated installs make direct adoption harder to estimate.
- **Vouched for: 5.9** (likely 4.8 to 7.4)
  - Claude Opus 5.5 (5.0): It is widely used and has long been the usual JS answer for general math, and it has 278 contributors. Independent write-ups about money math recommend decimal.js or bignumber.js instead, and I found no current survey data or named production users of mathjs for decimal work.
  - GPT-6.2 Sol (6.7): OpenSearch Dashboards depends on 15.2.0, and AltoDocs documents how its MathCanvas product checks results from Math.js decimal and unit calculations. British Columbia's waste reporting project also documented a passing formula parity test against its Java backend. The strongest public examples concern analytics and formulas, so confidence is lower for money-specific workloads and developer satisfaction.
- **Safe: 6.2** (likely 4.5 to 7.3)
  - Claude Opus 5.5 (6.0): Two HIGH advisories in April 2026 allowed arbitrary JS execution through the expression parser. They were fixed in 15.2.0 within days, and two CRITICAL ones of the same kind appeared in 2017. The risk mainly affects apps that evaluate untrusted expressions. Scorecard is 5.7, with weak Token-Permissions, SAST, Fuzzing and Code-Review. It has 9 dependencies and an Apache-2.0 licence.
  - GPT-6.2 Sol (6.3): Version 15.2.0 fixed both distinct April parser vulnerabilities before their public advisories. The parser adds risk when it evaluates untrusted input, and nine direct dependencies, manual npm publishing, and weak Scorecard marks for token permissions and code review add supply-chain exposure. Apache-2.0 is permissive, and the bundled CSparse port carries LGPL-2.1-or-later terms. The range reflects the difference between using arithmetic functions and exposing the expression parser.

## Good

- Its expression parser lets you evaluate formulas like '0.1 + 0.2' with BigNumber or Fraction types, which the dedicated decimal libraries cannot do.
- It covers far more than decimals: units, matrices, complex numbers, fractions, bigint and statistics.
- It ships its own TypeScript types, has thorough docs, and has been developed for 13 years with regular feature releases.
- It uses the permissive Apache-2.0 licence.

## Bad

- It is much heavier than decimal.js or big.js when all you need is exact decimal or money arithmetic.
- BigNumber mode is a global config on a math instance, which is clumsier than a direct Decimal API. It also has no money or currency type.
- The expression parser keeps producing sandbox-escape advisories: two HIGH ones in April 2026 and two CRITICAL ones in 2017.
- One main maintainer carries most of the work, and only two npm versions shipped in the last year.

## The numbers

- Downloads, 4 weeks: 22M
- In a year: ×3.4
- GitHub stars: 15k
- Commits, 12 months: 62
- Last npm release: Apr 2026
- Advisories, 24 months: 2
- Licence: Apache-2.0
- GitHub: https://github.com/josdejong/mathjs
- npm: https://www.npmjs.com/package/mathjs

Scores run from 0 to 10 and are the mean of the scores of AI reviewers (Claude Opus 5.5, GPT-6.2 Sol), made on 22 November 2026 from GitHub, npm, OSV, OpenSSF Scorecard, ecosyste.ms, Hacker News and Bluesky data and a web search. The ecosyste.ms count of repositories that use a project is far too low for projects that grew in the last few years, and some reviews quote it. Overall is the reviewers' own judgement for a new project today, not an average of the parts. An AI wrote them and can be wrong.
