Skip to content
Verification

Rounding is a business rule: why one cent deserves a person's attention

When two systems disagree by a cent, the bug is rarely in the arithmetic. It is in a decision nobody wrote down.

By the Tavuni team4 min read

Two systems calculate the same invoice and disagree by one cent. The instinct is to call it noise, widen the tolerance and move on. Sometimes that is right. More often the cent is the visible end of a decision somebody made years ago, wrote down nowhere, and built into one system but not the other.

A cent is a decision#

Take an invoice with two lines, each carrying exactly $0.125 of tax. Round each line to the cent and add them: $0.13 + $0.13 = $0.26. Add them first and round the total: $0.25 rounds to $0.25. Neither answer is wrong. They are two different policies, and in many businesses the choice between them was made by a tax adviser, an ERP default, or whoever built the first spreadsheet.

That is the shape of most one-cent differences: not arithmetic going wrong, but two systems following two different rules about where and how to round, and nobody having written either rule down.

Before you ask which system is right, ask which rule each one follows.

Three sources of a one-cent gap#

1. Where the rounding happens

Per line or per total, before tax or after, on the unit price or on the extended price. Each placement is defensible; mixing them across two systems guarantees small disagreements on a predictable minority of records.

2. How a midpoint is broken

When a value lands exactly halfway, a method has to choose a direction, and the common methods choose differently:

Method2.53.5−2.5Where you meet it
Half away from zero34−3Excel’s ROUND
Half to even (banker’s)24−2Python’s round(), IEEE 754 default, many accounting systems
Half up (towards +∞)34−2JavaScript’s Math.round

Half to even exists for a good reason: over many values it does not drift upwards, which matters when you add up thousands of rounded amounts. Half away from zero is what most people learned at school. Neither is a bug; but if your workbook uses one and your new system uses the other, every exact midpoint will disagree.

3. Numbers the computer cannot hold exactly

Most software stores numbers in binary floating point, which cannot represent most decimal fractions exactly. The value 2.675 is stored as something very slightly below it, so in JavaScript (2.675).toFixed(2) gives 2.67, while Excel’s ROUND(2.675, 2) gives 2.68. The midpoint was never really a midpoint in the first system. This is why money is better calculated in exact decimal arithmetic, which is what Tavuni’s calculated fields use.

Midpoints, specifically#

Exact midpoints are rare, which is why they survive testing. A spot check of ordinary orders will almost never hit one. A value-by-value check across a whole workbook will, and when it does, the two systems will each have an answer that is correct by its own rule.

That is why a midpoint disagreement deserves its own category in a verification report, separate from both “agrees” and “different”. On the example workbook Tavuni ships with, checking 2,870 values found 1 sitting exactly on a rounding midpoint (the Order.freight field, in cell Orders!L102). It is reported on its own line, for a person to decide, rather than counted as a pass or hidden in a tolerance.

How to report it#

  1. Classify, do not absorb. Representation noise counts as agreement. An exact-midpoint disagreement is a rounding edge. Everything else is a difference.
  2. Show the cell. For every rounding edge, list the source cell and both values, so the person deciding can see the case, not a statistic.
  3. Decide the rule once, in words. “Tax is rounded per line, half away from zero, to the cent.” One sentence, agreed with whoever owns the numbers.
  4. Make both systems follow it. Then the rounding edge either disappears or becomes a genuine difference worth investigating.

More on the method behind this in how to check a migrated calculation, value by value.

Written by the Tavuni team. Where an example uses Tavuni’s own output, the numbers come from the example workbook at /try and were computed when this page was built. Corrections are welcome: tell us.

All articles

Try the idea on a real workbook.

The live verification reads an example operations workbook in your browser, compiles its rules and checks every value. No account, nothing uploaded.