Elestia Open Source Ratings
5.8

Math.js

Reasonable, with limits. 5th of 8 numbers and money.

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.

WebsiteGitHubnpm

Scores

Overall5.8

How strongly do we recommend it for a new project today?

Claude Opus 5.5: 5.0, likely 4.0 to 6.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, likely 5.5 to 7.8

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 many4.8

How many developers need a tool for this job?

Claude Opus 5.5: 5.0, likely 4.0 to 6.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.

  • npm-compare.com/big.js,bignumber.js,decimal.js,mathjs: A comparison says mathjs is the choice for expression parsing and scientific work, not for plain decimal math.
  • github description: The repo describes itself as 'An extensive math library', not a decimal or money tool.

GPT-6.2 Sol: 4.5, likely 3.3 to 5.8

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 lot6.6

How well does it do the job for those who need it?

Claude Opus 5.5: 6.0, likely 5.0 to 7.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, likely 5.9 to 8.2

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 time6.9

Will it still be a good choice in two years?

Claude Opus 5.5: 7.0, likely 5.0 to 8.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.

  • github commitsLastYear: 62 commits in the last year.
  • npm versionsLastYear: 2 versions in the last year; latest 15.2.0 on 2026-04-07.
  • gitHub.com/sponsors/josdejong: Funding comes mainly through GitHub Sponsors for a single lead maintainer.
  • github openPullRequests: 98 open PRs suggest a review backlog.

GPT-6.2 Sol: 6.8, likely 5.5 to 8.0

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 widely5.6

How many use it, and is that growing?

Claude Opus 5.5: 6.0, likely 5.0 to 7.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.

  • npm downloadsLast4Weeks: 22.2M now vs 6.5M a year ago: ratio 3.4, below the median of 4.1.
  • dependents: 15,286 repos and 1,941 packages, against 958k repos for decimal.js.
  • github stars: 15.1k stars, the most in the category.

GPT-6.2 Sol: 5.2, likely 4.0 to 6.4

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.

  • npm downloadsLast4Weeks, npm downloadsSame4WeeksYearAgo, medianDownloadsRatio: 3.40× year-over-year growth versus the 4.10× catalog baseline.
  • dependents and peers: 15,286 observed repos and 1,941 packages, with much larger repo counts for dedicated decimal peers.
  • github stars, bluesky, and hackerNews: 15,106 stars, one Bluesky post about seeded randomness, and zero matched Hacker News stories.
  • mathjs.org/download.html: Documents direct downloads and several CDN distribution channels.
Vouched for5.9

Who stands behind it being good?

Claude Opus 5.5: 5.0, likely 4.0 to 7.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, likely 5.5 to 7.8

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.

Safe6.2

How safe is it to depend on?

Claude Opus 5.5: 6.0, likely 4.0 to 7.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.

  • advisories.gitlab.com/npm/mathjs/GHSA-jvff-x2qm-6286: CVSS 8.8 arbitrary JS execution via the parser, fixed in 15.2.0.
  • advisories: 5 total, 2 in the last 24 months, all in the expression evaluation area.
  • scorecard score: 5.7, with 0 on Token-Permissions, SAST and Fuzzing, and 3 on Code-Review.
  • npm dependencies: 9 runtime dependencies, more than the zero-dependency decimal peers.

GPT-6.2 Sol: 6.3, likely 4.9 to 7.5

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

npm downloads, 4 weeks
22M ×3.4 in a year
GitHub stars
15k
Commits, 12 months
62
npm version
15.2.0 Apr 2026
Versions, 12 months
2
Advisories, 24 months
2 of 5 ever
OpenSSF Scorecard
5.7 out of 10, Oct 2026
Licence
Apache-2.0

Read on 21 November 2026 from GitHub (josdejong/mathjs), npm (mathjs), OSV and the OpenSSF Scorecard.

Numbers and money

  1. 7.5decimal.js
  2. 7.3bignumber.js
  3. 7.2Dinero.js
  4. 6.5big.js
  5. 5.8Math.js
  6. 4.4currency.js
  7. 3.8Numbro
  8. 3.2Numeral.js
Compare all 8 on six scores