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.
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.
- npm-compare.com/big.js,bignumber.js,decimal.js,mathjs: Decimal peers are recommended for plain money arithmetic.
- peers decimal.js downloadsLast4Weeks: 557M downloads and 958k dependent repos show where users go for decimals.
- feed.craftedsignal.io/briefs/2026-04-mathjs-rce: The 2026 RCE advisory means user expressions need care.
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.
- altodocs.io/verification: Shows the benefit of combining high-precision decimal arithmetic with units and formulas.
- github.com/MikeMcl/decimal.js: The standalone decimal engine has zero dependencies.
- github.com/dinerojs/dinero.js/blob/main/CHANGELOG.md: Documents currency metadata, scale, and lossless allocation.
- tc39.es/ecma402/#sec-intl-numberformat-prototype-format: Defines built-in locale-aware formatting.
- npm versionsLastYear, npm downloadsLast4Weeks, npm downloadsSame4WeeksYearAgo, and medianDownloadsRatio: Two npm releases in the last year and growth below the catalog baseline.
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.
- 2025.stateofjs.com/en-US/usage: Finance, commerce, and data analysis are substantial but distinct segments.
- dev.to/benjamin_renoux/financial-precision-in-javascript-handle-money-without-losing-a-cent-1chc: A fintech practitioner explains decimal precision and currency-specific minor units.
- github.com/josdejong/mathjs: Browser and Node.js support with formulas and multiple numeric types.
- tc39.es/ecma402/#sec-intl-numberformat-prototype-format: The standard library specifies locale-aware number formatting.
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.
- github.com/josdejong/mathjs/blob/develop/HISTORY.md: Steady feature work in 2025-2026: bigint support, optional chaining in the parser, performance gains.
- npm-compare.com/zh-CN/big.js,bignumber.js,decimal.js,mathjs: Notes that BigNumber mode is set globally through config and that mathjs is heavier.
- npm hasTypes: Ships its own TypeScript types.
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.
- mathjs.org/docs/datatypes/bignumbers.html: Documents decimal.js, the 64-digit default, and tolerance settings.
- mathjs.org/docs/datatypes/fractions.html: Exact rational arithmetic is available for supported operations.
- mathjs.org/docs/reference/functions/format.html: Supports fixed and scientific displays and illustrates currency output with a callback.
- github.com/josdejong/mathjs/issues/3635: A TypeScript user reports that evaluate returns any.
- github.com/josdejong/mathjs/issues/3729: A user reports engineering notation printing zero for very large BigNumbers.
- github.com/dy/subscript: A third-party benchmark finds slower parsing than several alternatives on one expression.
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.
- github commitsLastYear and npm versionsLastYear: 62 commits and two npm versions in the past year.
- npmjs.com/package/mathjs?activeTab=versions: Confirms 15.2.0 as the latest npm release despite the empty GitHub Releases count.
- github.com/josdejong/mathjs/blob/develop/HISTORY.md: Lists fixes from several contributors awaiting release and breaking changes in version 15.
- socket.dev/npm/package/mathjs/versions/14.6.0: Shows the same npm publisher across the recent releases.
- github.com/josdejong/mathjs/blob/develop/.github/FUNDING.yml: Lists a personal GitHub Sponsors account.
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.
- spin.atomicobject.com/javascript-math-precision-decimals: A practitioner post on precise decimal math picks decimal.js and does not mention mathjs.
- github contributors: 278 contributors.
- bluesky posts: Only 1 post in 24 months.
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.
- github.com/opensearch-project/OpenSearch-Dashboards/blob/main/package.json: The OpenSearch Dashboards manifest lists Math.js as a runtime dependency.
- altodocs.io/verification: A downstream product documents 64-digit calculations and named reference checks.
- github.com/bcgov/nr-waste-plus/issues/1222: Documents adoption in the formula editor and agreement with backend test fixtures.
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.
- github.com/josdejong/mathjs/security/advisories/GHSA-29qv-4j9f-fjw5: The first high-severity parser issue was fixed in 15.2.0.
- github.com/josdejong/mathjs/security/advisories/GHSA-5v89-rwgr-qj6g: The second issue was fixed in 15.2.0 and this advisory replaces the earlier filing.
- mathjs.org/docs/expressions/security.html: The project recommends isolation for untrusted expressions.
- scorecard and npm dependencies: Scorecard 5.7, code review 3 out of 10, token permissions 0 out of 10, and nine direct dependencies.
- raw.githubusercontent.com/josdejong/mathjs/v15.2.0/misc/how_to_publish.md: The release guide documents a manual npm publish step.
- github.com/josdejong/mathjs#license: Documents Apache-2.0 and the LGPL-2.1-or-later CSparse component.
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.