Results of 10,000 amount splits: standard rounding mismatched 62.82 percent while largest remainder had zero mismatches

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.

text
10,000 trials total
2,000 each: 3, 4, 5, 10 and 20 recipients
amount: 1,000 to 1,000,000 cents
weights: half equal; half random integers from 1 to 100
methods: round half up, round half even, floor, last-row adjustment, largest remainder

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

Bar chart: floor mismatched 89.97 percent, round half up 62.82 percent, round half even 62.79 percent and largest remainder zero percent
text
method                 mismatches    rate
round half up               6,282   62.82%
round half even             6,279   62.79%
floor / truncate            8,997   89.97%
largest remainder               0    0.00%

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

text
recipients   round-half-up mismatches   largest drift
3                       45.60%                 1 cent
4                       53.85%                 2 cents
5                       58.70%                 2 cents
10                      74.10%                 5 cents
20                      81.85%                10 cents

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.

text
$10.00 split by weights 1, 1, 1
exact shares       333.333¢   333.333¢   333.333¢
whole cents        333¢       333¢       333¢       = 999¢
one cent left
final allocation   334¢       333¢       333¢       = 1,000¢

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.

sql
with shares as (
  select id, total_cents,
         div(total_cents::numeric * weight, sum(weight) over ()) as base_cents,
         mod(total_cents::numeric * weight, sum(weight) over ()) as remainder
  from allocation_rows
), ranked as (
  select *, total_cents - sum(base_cents) over () as cents_left,
         row_number() over (order by remainder desc, id) as remainder_rank
  from shares
)
select id, (base_cents + case when remainder_rank <= cents_left then 1 else 0 end)::bigint as allocated_cents
from ranked
order by id;

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 amountSplit

Need to inspect the tables and queries behind an allocation? Pilotbase is a database client for PostgreSQL, MySQL, SQLite and more.

Get Pilotbase

Method 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.