Round half to even, also known as banker's rounding, is a rounding rule in which a value exactly halfway between two numbers is rounded to the nearest even number. Under this rule 0.5 rounds to 0 and 1.5 rounds to 2, whereas the more familiar round half up rule would give 1 and 2.
Why it matters: Different languages, libraries and database engines use different rounding rules by default. When one layer of a system rounds half up and another rounds half to even, the same calculation can produce different answers. Over large datasets those small differences add up, which is a known source of discrepancies in financial reports and reconciliations.
In practice: Testers find out which rounding rule each part of the system is supposed to use, then test values that sit exactly on the midpoint. Useful checks include:
- Entering values such as 0.5, 1.5, 2.5 and 2.675 and comparing results across the UI, API and database.
- Summing many midpoint values to see whether totals drift between layers.
- Checking that displayed values match stored values after rounding.
Where the requirements do not say which rule applies, that is a spec gap worth raising before the feature is built.
Examples:
- A report generated in the database rounds 2.5 to 2 while the web front end shows 3 for the same figure.
- Monthly invoice totals differ by a few pence from the finance system because each line was rounded with a different rule.
- A grading tool rounds a score of 69.5 down to 69 and fails a student who expected a pass.
Common pitfalls:
- Assuming every layer of a system rounds the same way because they produce the same result for most values.
- Testing with values that are not exactly on the midpoint, so the difference between rules never appears.
Why is it called banker's rounding? Rounding halves to the nearest even number avoids the slight upward bias of always rounding half up, which matters when many values are summed, as in banking and accounting.