A bill, fee or budget has to be split by percentages. You calculate each share, round it to two decimal places, and discover that the rows add up to $99.99 or $100.01 instead of $100.00. Which row should get the missing penny? And how often does this actually happen?
We ran 10,000 equal and weighted splits across 3, 4, 5, 10 and 20 recipients. Ordinary round-half-up missed the input total in 6,282 trials (62.82%). The gap reached 10 cents. The largest remainder method matched the total in all 10,000.
What we tested
For each trial we picked an amount from $10.00 to $10,000.00 in integer cents. Half the trials used equal weights; the other half used random integer weights from 1 to 100. There were 2,000 trials for each recipient count. A fixed random seed makes the run repeatable.
We calculated exact shares with decimal arithmetic. We then compared the sum of the allocated integer cents with the original integer-cent total. This measures allocation drift, not binary floating-point error.
The result
Banker's rounding barely changed the answer: 6,279 mismatches instead of 6,282. Its tie rule helps only when the discarded part is exactly half a cent. Random weighted shares usually have other fractions.
Flooring every row was worse. It left money unassigned in 8,997 trials. Flooring is useful as the first step of largest remainder, but it is not a complete allocation rule by itself.
More rows, more drift
With three recipients, ordinary rounding already failed almost half the time. With 20 recipients it failed in more than four out of five splits. Each row can be less than half a cent high or low, but those small errors accumulate.
Why putting the difference on the last row is not neutral
A common patch is to round every row and force the final row to absorb the difference. It makes the total reconcile, but in our run it changed the last recipient in 6,270 trials, sometimes by 10 cents. Row order then decides who is subsidised or penalised.
That may be acceptable when the last row is a deliberate balancing account. It is a poor default when the rows are people, stores, departments or partners with equal standing.
Largest remainder, in plain words
Work in integer minor units. Calculate every exact share, give each row its whole cents by rounding down, then hand the leftover cents to the rows with the largest fractional remainders. Use a stable key or original row order to break exact ties.
Across our 10,000 trials this method had zero mismatches. Every row stayed within one cent of its exact share. That is the useful guarantee: exact conservation for the total, with the smallest possible integer-cent adjustment to individual rows.
SQL shape
This version is for PostgreSQL. total_cents holds the same total on every row in allocation_rows.
Keep a deterministic tie-breaker in the order by. Without it, two rows with the same remainder can swap the extra cent between runs even though the grand total remains correct.
What this test does not prove
The trial uses positive weights and amounts with two decimal places. Refunds, zero weights and currencies with zero or three minor-unit decimals need explicit rules. It also does not choose your legal or accounting policy: tax authorities and contracts may require line-level rounding at a particular step.
The result does show that changing half-up to half-even does not solve allocation drift. You need a conservation step, whether that is largest remainder or a clearly named balancing account.
Paste a CSV or Excel file, choose the amount and weight columns, and split the total in exact minor units. The tool exports CSV, Excel and SQL and uses largest remainder with stable row order for ties.
Open amountSplitNeed to inspect the tables and queries behind an allocation? Pilotbase is a database client for PostgreSQL, MySQL, SQLite and more.
Get PilotbaseMethod and raw numbers: our benchmark run on 2026-11-26, 10,000 seeded trials, recorded in results.json and summary.json. Related: Money in SQL: numeric vs float vs integer cents.


