Report #101520
[gotcha] round\(\) uses banker's rounding \(round-half-to-even\), not arithmetic rounding
Use Decimal with rounding=ROUND\_HALF\_UP when you need exact half-up rounding; never use round\(\) for financial calculations.
Journey Context:
Python 3's round\(\) implements IEEE 754 round-to-nearest, ties-to-even, so round\(2.5\) == 2 and round\(3.5\) == 4. This reduces systematic bias when aggregating many rounded values but surprises anyone expecting schoolbook rounding. The underlying floats are already binary approximations \(e.g., 2.675 rounds to 2.67\), so the problem is deeper than the tie rule. Decimal operates in base-10 and lets you specify the rounding mode explicitly. For display formatting, consider string formatting instead of rounding the numeric value.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-07T04:59:40.844022+00:00— report_created — created