Skip to content
BedrockCalculator
Back to Calculator Catalog

How the calculators work

Methodology: How the Calculators Are Built and Checked

Every calculator on Bedrock Calculator is assembled from a shared library of calculation modules, fed by statutory tables that record where each figure came from, and tested before it is published. This page explains each of those steps, what they catch, and where they stop.

Written by Aapt Dubey, MBA (Marketing & Banking), ISB Chandigarh. See the About page for background. Last updated .

calculators published
1,236
shared calculation modules
259
2026 statutory data tables
32
engine test files, plus one per calculator
278

1. How a calculator is built

A mortgage calculator, a car loan calculator and a boat loan calculator do the same arithmetic with different labels. So the maths is written once, in a module under /engine/primitives, and each calculator is a thin configuration that calls it. No calculator contains its own formula.

Each calculator is three files in its own folder:

  • config.ts declares the inputs, their defaults and limits, the outputs, and which engine modules the calculator calls.
  • content.mdx is the page you read: the quick answer, how the result is calculated, a worked example, what the calculator leaves out, and its sources.
  • vectors.test.ts runs the configuration on fixed inputs and checks the answers. Its test names are listed on the calculator page.

One route renders every calculator from those files. When a module is fixed, every calculator that uses it gets the fix at once, and every one of their tests runs against it. The catalog itself lives in a single registry file, and a validator checks that the modules a calculator declares are exactly the ones its code calls. That matters because the related-calculator links on each page are chosen by shared modules, so a false declaration would send readers to the wrong place.

2. Exact decimal arithmetic (money.ts)

JavaScript stores numbers in binary floating point, which cannot represent most decimal fractions exactly (0.1 + 0.2 = 0.30000000000000004). Across a 360-row loan schedule those errors can add up to visible cents. Money arithmetic in the engine uses a decimal library instead:

// engine/primitives/money.ts

Decimal.set({ precision: 34, rounding: Decimal.ROUND_HALF_UP });

Thirty-four significant digits, rounding halves up as a person would, not to the nearest even digit as some financial software does. One honest exception: problems with no closed-form answer, such as solving for an interest rate, are solved iteratively in ordinary floating point to a tolerance of one ten-billionth, and the answer is then handed back as a decimal.

3. Loan schedules that add up (amortization.ts)

Every amortization schedule is checked with reconcile(), which adds up the principal paid in every period and compares it with the amount borrowed:

∑ (principal paid in each period) = original loan principal

The payment and each period's interest are rounded to the cent as a lender posts them, so the balance carried forward is always a real amount of money. The final payment is the remaining balance plus that period's interest, which is why it differs from the others by a few dollars. The guide to the final payment works through a full example.

4. Time value of money (tvm.ts)

Loan payments, savings growth and annuities all rest on one equation, solved for whichever of present value, future value, payment, number of periods or rate is unknown. Cash paid out is negative and cash received is positive:

PV·(1+i)ⁿ + PMT·(1 + i·type)·[((1+i)ⁿ − 1) / i] + FV = 0
  • Zero rate. At a 0% rate the equation divides by zero, so each solver has a separate straight-line branch: future value is just the starting amount plus the payments.
  • Solving for the rate. There is no formula for the rate, so the engine starts at 10% and refines the guess with Newton-Raphson. If that fails to settle, it falls back to bisection between -99.99% and 1,000% per period, which settles on an answer whenever one can be bracketed in that range.
  • Payment timing. Payments at the end of each period (most loans) and at the start (leases, many savings plans) are both supported.

The baseline test is the payment on $100,000 at 6% over 30 years, $599.55 a month, the same figure an HP-12C financial calculator returns.

5. Day-count conventions (daycount.ts)

Interest for part of a year depends on how the days are counted. Bonds, Treasury bills and commercial loans each use a convention, and the engine supports four:

30/360 US

Every month counts as 30 days, with the US rule for the end of February. Used for most US corporate and municipal bonds.

ACT/ACT ISDA

Actual days, split at the year boundary so days in a leap year are divided by 366 and the rest by 365. The ISDA definition used for many interest rate swaps.

ACT/365 Fixed

Actual days divided by 365, leap year or not. Common in sterling money markets.

ACT/360

Actual days divided by 360, so a full year earns slightly more than the quoted rate. Used for Treasury bill discount yields and much commercial lending.

The day-count guide shows the same $1,000,000 earning different interest under each.

6. Where the figures come from

Tax brackets, wage bases, contribution limits and life tables live in JSON tables under /engine/tables/{year}/, not in the calculators. Every table records a verifiedOn date, and most also record the issuing document, a link to it and the date the figures take effect. The order of preference for a source:

1
Statute, regulation and the agency’s own tables

For 2026 federal income tax, IRS Revenue Procedure 2025-32. For premium tax credits, Rev. Proc. 2025-25. For Social Security, the SSA’s 2026 COLA fact sheet; for Medicare IRMAA, the CMS 2026 premiums fact sheet; for required minimum distributions, IRS Publication 590-B; for depreciation, IRS Publication 946; for life expectancy, the SSA Office of the Chief Actuary period life table.

2
The equivalent authority abroad

HMRC and gov.uk for the UK, the CRA for Canada, the ATO for Australia, IRAS for Singapore, Skatteetaten for Norway, and each other country’s tax or social security agency. International calculators state their currency and jurisdiction and cite the authority in their own Sources section.

3
A named compiler, where no government publishes one table

Some figures have no single official source: average effective property tax by state, combined state and local sales tax, or cost of living. For those, the table names the compiler it relies on, such as the Tax Foundation, Census-based figures from SmartAsset, or MERIC, and the calculator's Sources section cites it.

Primary-source checking has found real errors here. In August 2026 the federal tax tables, FICA, IRMAA and the SSA life table were found to hold 2024 or 2025 figures, as did five states' estate tax rules, four states' corporate rates and three states' property tax rates. Nineteen states' income tax brackets were refreshed after their tables turned out to hold an earlier year's schedule.

7. How the calculators are tested

Each engine module has its own test file of golden vectors: fixed inputs with answers worked out by hand, often with the arithmetic written in a comment above the check. Each calculator then has its own test file that runs its real configuration. Where a tax authority publishes a worked example, the example goes into a test, so the engine has to reproduce the authority's own figure.

Those comparisons, from the IRS, the VA, HMRC, IRAS in Singapore, Skatteetaten in Norway and others, are published side by side with our output, with a link to each source document.

How we test our calculators

8. Checking the words, not just the numbers

The most common defect on this site has not been bad arithmetic. It has been text describing a calculator more capable than the one that exists. In August 2026 about 150 pages described steps no code performed: 47 cost-of-living pages said spending was split across six weighted categories when the engine scales by a single factor. Numeric tests cannot see that, because a made-up step contains no number. Four automated checks now cover it:

  • Each page's Quick Answer must state the figure its own engine computes for the default inputs.
  • On property tax pages, the rate stated in the text must match the rate the engine uses, so a corrected figure cannot leave its old label behind.
  • A mechanism audit flags any "How this is calculated" step that names something with no trace in the code the page is bound to.
  • An output audit runs every calculator and fails if a result the page promises is missing.

None of these reads prose the way a person does. Text that describes a mechanism in different words from the code can still slip past, which is why every "How this is calculated" section is written by reading the configuration and each module it calls, step by step. A simplification is allowed, but it is listed under "What this does not account for", not described as something the calculator does.

9. How the calculators are kept current

  • New tax years. Tables are filed by year. A test fails on its own once the calendar passes the newest year on file, and again if any table goes more than 18 months without being re-verified. The checks run weekly even when no code has changed, so a stale year is flagged without anyone having to remember it. The fix is to re-read each primary source and record the new figures, never to copy last year forward.
  • Every change. Type checking, the full test suite, registry validation, a production build and the audits above run on every push to the main branch and on every pull request.
  • Dates. The "Last updated" date on a calculator or guide is the date of the last committed change to that page's own text file, taken from the project's version history. It does not move when an unrelated part of the site changes.
  • Corrections. Significant errors and their fixes are listed on the About page. If you find one, the contact page is the fastest route; reports are checked against the primary source.