Skip to content

Money movement and financial logic

Financial calculation testing

Financial calculation testing checks every formula that becomes money: interest accrual and day count, APR, amortisation schedules, fees, FX conversion, rounding, tax, and proration. Lending, BNPL, payroll, billing, and tax software teams receive a calculation specification with worked reference values, a boundary and rounding test suite, an independent reference model, and a discrepancy report with monetary impact.

What financial calculation testing covers

A calculation defect repeats on every record that uses the formula, so one wrong rounding point becomes a customer overcharge, a disclosure error, or a loss on every loan, invoice, payroll, or transfer. We test the arithmetic behind fees, interest, FX, accruals, rewards, and tax against reference values that the system under test did not produce.

Interest accrual and day count conventions

A day count convention decides the interest on the same balance. On 100,000.00 at 5.00% for 1 March to 1 April, Actual/360 gives 430.56, Actual/365 Fixed gives 424.66, and 30/360 gives 416.67. We check that each product uses the convention in its contract, including leap years: on the same balance and rate, Actual/365 Fixed over the 366 days of 2028 accrues 5,013.70, and Actual/Actual (ISDA) accrues 5,000.00.

The rounding point matters as much as the convention. Daily interest on the same balance under Actual/365 Fixed is 13.69863. An engine that rounds each day to 13.70 accrues 5,000.50 over a 365-day year instead of 5,000.00. The interest accrual and day count testing guide shows the test data for these cases.

APR and amortisation schedules

For US consumer credit, we recalculate the APR under appendix J to 12 CFR Part 1026, which treats all months as equal (paragraph (b)(3)(iv)). We compare it with the disclosed APR against the 1/8 of 1 percentage point tolerance for regular transactions in 1026.22(a)(2) and the 1/4 of 1 percentage point tolerance for irregular transactions in 1026.22(a)(3) (eCFR, checked on 2026-09-16). The Regulation Z page lists the related disclosure findings.

Amortisation tests check invariants on every schedule: principal components add up to the amount financed, and the final payment carries the residual cent. A 1,000.00 purchase in three instalments at 0% is 333.33, 333.33, and 333.34; three instalments of 333.33 leave 0.01 uncollected. We also cover long first periods, due dates on the 29th to 31st, and early repayment.

Fees, rewards, tax, and proration

Fee schedules fail at their edges. We test amounts on both sides of each tier threshold, whole-amount against marginal tiering, and minimum and maximum fees applied before or after rounding. Reward accrual is tested the same way: 1.5% cashback on 19.99 is 0.29985, which is 0.30 when rounded and 0.29 when truncated.

Tax rounding depends on where the rule rounds. Three invoice lines of 0.35 at 7% give 0.06 of tax when each line is rounded half up, and 0.07 when the invoice total is rounded. The specification records which rule applies, and the suite tests both paths. Proration tests use 28, 29, 30, and 31-day months as the divisor.

FX conversion and ISO 4217 minor units

ISO 4217 sets 0 minor units for JPY and KRW, 3 for KWD and BHD, and 4 for CLF (SIX list published 2026-01-01). A conversion that always rounds to two decimals produces amounts that a JPY or KWD account cannot hold.

For US remittance transfers, 12 CFR 1005.31(b)(1)(iv) requires the disclosed exchange rate to be rounded consistently for each currency to no fewer than two and no more than four decimal places. Paragraph (b)(1)(vii) states that the exchange rate used to calculate the Total to Recipient is the rate prior to any rounding. On 1,000.00 at 17.23456, the correct amount is 17,234.56, and the rounded rate 17.2346 gives 17,234.60. The Regulation E page covers the rest of the disclosure.

Rounding modes and number representation

We confirm the rounding mode per formula: half-even, half-up, or truncation. Binary floats hide defects: Python's round(2.675, 2) returns 2.67 because the float stores slightly less than 2.675 (Python documentation). The banker's rounding testing guide gives the tie cases we generate.

Reference models and property-based testing

The reference model is built from the calculation specification, never from the system's code, in decimal arithmetic. Python's decimal module defaults to 28 digits of precision with ROUND_HALF_EVEN (Python documentation). Property-based tests with Hypothesis or fast-check generate amounts, rates, dates, and currencies, and assert properties: instalments add up to the total, rounding a rounded amount changes nothing, and a converted amount has exactly the minor units of its currency. Each failing case shrinks to a minimal input and becomes a fixed regression case.

Deliverables

  • Calculation specification with worked reference values

    A versioned document that states each formula with its day count convention, rounding mode, rounding point, and ISO 4217 minor units, plus worked inputs and outputs that product, finance, and engineering leads sign off.

  • Boundary and rounding test suite per formula

    Automated tests for each formula that cover tier thresholds, exact half-cent ties, zero-decimal and three-decimal currencies, leap days, and month-end dates, and that run in the client's CI pipeline.

  • Independent reference model for recalculation

    A separate decimal-arithmetic implementation of the calculation specification that recalculates system outputs and acts as the test oracle for generated and property-based cases.

  • Discrepancy report with monetary impact

    A per-release list of each difference between system and reference values, with the formula, the amount per transaction, the affected records, and the severity, for engineering leads and auditors.

How calculation tests fit your release process

Pull requests. The boundary and rounding suite runs as unit-level tests in your CI on each change to a calculation module. A difference from a reference value fails the build with the formula, the inputs, and both values.

Nightly runs. Property-based tests run with a fixed seed set plus one logged random seed, so each failure is reproducible. The reference model recalculates a generated corpus of loans, invoices, payrolls, and transfers and writes discrepancies to the report.

Configuration releases. Fee schedules, rate tables, tax tables, and currency lists change without a code deploy. Each such change triggers the pre-release suite, and a new ISO 4217 amendment from the maintenance agency is treated as a configuration change. Currency tests read minor units from the ISO 4217 list, so a changed exponent fails the suite before the currency goes live in your product.

Release gate. You set the tolerance per formula: zero for disclosed amounts, and the 1026.22 tolerance for APR. The discrepancy report with monetary impact is attached to the release, and any difference above tolerance blocks it.

After release. A smoke check recalculates a sample of production outputs in the reference model. Production samples that contain account data are masked first under the procedures on our security page; all other runs use synthetic records in XTS, the ISO 4217 code reserved for testing.

Handover. The calculation specification, the reference model, and the suite live in your repository. Your product and finance leads own formula sign-off, and your engineers can run every test without us. Ledger postings that result from these calculations are verified by ledger and reconciliation testing.

Sample deliverable

Sample, synthetic data

calculation reference matrixCalculation reference matrix: proration, APR, supplemental withholding, vesting, per diem, and tax line rounding
Calculation reference matrix: proration, APR, supplemental withholding, vesting, per diem, and tax line rounding
Case IDCalculation and ruleInputsReference valueSystem valueResult
CALC-01Mid-cycle plan upgrade proration; plan terms prorate the old and new plan prices by whole days remaining in the billing periodOld plan 30.00 per 30-day period; new plan 90.00 per 30-day period; upgrade effective at 00:00 on day 11, leaving 20 days40.0040.00Pass: the system charges 60.00 for the new plan and credits 20.00 for the old plan, matching the reference
CALC-02APR on a closed-end loan with an origination fee; actuarial method under 12 CFR 1026, appendix J; the APR shall be considered accurate if it is not more than 1/8 of 1 percentage point above or below the reference under 12 CFR 1026.22(a)(2)Principal 10,000.00; origination fee 300.00 withheld from proceeds; note rate 9.00%; 36 monthly payments of 318.00; amount financed 9,700.00 under 12 CFR 1026.18(b)(3)11.09%9.00%Fail: the system solves the APR against the 10,000.00 principal instead of the 9,700.00 amount financed, 2.09 percentage points below the reference; critical; blocks release
CALC-03APR on a closed-end loan with an origination fee; actuarial method under 12 CFR 1026, appendix J; the APR shall be considered accurate if it is not more than 1/8 of 1 percentage point above or below the reference under 12 CFR 1026.22(a)(2)Principal 5,000.00; origination fee 100.00 withheld from proceeds; note rate 12.00%; 24 monthly payments of 235.37; amount financed 4,900.0014.05%14.00%Pass: the system APR is 0.05 percentage points below the reference, inside the 1/8 of 1 percentage point tolerance
CALC-04Federal income tax withholding on a supplemental wage payment at the flat rate; IRS Publication 15 (2026), section 7: if income tax was withheld from regular wages in the current or immediately preceding calendar year, the employer can withhold a flat 22% on supplemental wages identified separatelyBonus 5,000.00 paid separately from regular wages; income tax withheld from regular wages in 2026; supplemental wages before the payment 20,000.00; employer elects the flat rate1,100.001,100.00Pass: the system withholds 22% of 5,000.00, matching the reference
CALC-05Federal income tax withholding on a supplemental wage payment that crosses 1,000,000.00 in the calendar year; IRS Publication 15 (2026), section 7: the excess over 1 million is subject to withholding at 37%, without regard to the employee's Form W-4Bonus 50,000.00 paid separately from regular wages; supplemental wages paid in 2026 before the payment 980,000.00; employer elects the flat rate for the amount up to 1 million15,500.0011,000.00Fail: the system applies 22% to all 50,000.00 instead of 22% to 20,000.00 and 37% to 30,000.00, so 4,500.00 is under-withheld; critical; blocks release
CALC-06Stock option vesting with a one-year cliff; grant agreement vests 25% at the first anniversary, then 1/48 of the grant monthly on the commencement day, or on the last day of a month without that dayGrant of 48,000 options; vesting commencement 2025-01-31; cliff date 2026-01-31; vested balance requested as of 2026-02-2813,000 options12,000 optionsFail: the system skips the February vesting event because February has no 31st day, so 1,000 vested options cannot be exercised; high; blocks release
CALC-07Per diem allowance for meals and incidental expenses under the high-low method; IRS Notice 2025-54, section 5, paragraph 1: 86.00 per day for a high-cost locality; Rev. Proc. 2019-48, section 6.04(1): the payor may allocate three-fourths of the rate to each partial day of travelTravel to Boston/Cambridge, a high-cost locality from October 1 to September 30 under Notice 2025-54, section 5, paragraph 2; departure 2026-08-10; return 2026-08-12; lodging reimbursed on receipts; payor policy uses the three-fourths method215.00258.00Fail: the system pays 86.00 for the departure and return days instead of 64.50 each, so the allowance is 43.00 above the reference; high; blocks release
CALC-08Taxable interest on a return rounded to whole dollars; Form 1040 instructions (tax year 2025): if you have to add two or more amounts to figure the amount on a line, include cents when adding and round off only the totalThree interest statements of 120.40, 80.40, and 45.40 for line 2b; return set to whole-dollar rounding246245Fail: the system rounds each statement before adding, so line 2b is 1 below the reference; medium; release allowed with the defect scheduled for the next release

Amounts use XTS, the ISO 4217 code reserved for testing, with rule thresholds stated in US dollars applied at one XTS per dollar. Loans, employees, grants, trips, and returns are generated test records, and every reference value was computed outside the system under test.

Questions

What is banker's rounding?

Banker's rounding, also called round half to even, rounds a value that lies exactly halfway between two candidates to the even candidate, so 0.125 becomes 0.12 and 0.135 becomes 0.14. Python's decimal module uses ROUND_HALF_EVEN in its default context. Half-even rounding avoids the upward drift that half-up rounding adds when many amounts end exactly on a half.

What is a rounding error?

A rounding error is the difference between an exact value and its rounded or binary approximation. In financial software, rounding errors appear when daily interest is rounded before it is summed, when a binary float stores 2.675 as slightly less than 2.675, or when an amount split into instalments leaves a residual cent that no instalment carries.

Scope your calculation testing

Send the formulas, rate tables, and currencies in scope, and we agree the reference values with you before any test runs.

Scope your testing