PassaTime
All stories
AI HELP · ROUNDING RULES 2026-10-14

AI rounded every row. Why does their sum differ from the rounded total?

Say when rounding happens as well as how many decimal places to keep. Adding rounded rows and rounding their exact sum can give different answers.

Python’s Decimal documentation provides explicit rounding modes and a quantize operation for a chosen number of places. We used decimal strings to make a small example reproducible, rather than treating displayed values as the original precision.

Three values, two legitimate calculations

Our invented values were 0.335, 0.335 and 0.335. With ROUND_HALF_UP to two places, each becomes 0.34 and the displayed rows add to 1.02. The exact sum is 1.005; rounding that sum once under the same rule gives 1.01. We executed both paths locally.

The tie rule also matters

For the same exact total, ROUND_HALF_EVEN gives 1.00 instead. We checked that result too. Do not choose a rounding policy because it makes an expected total appear; use the rule required by your actual task.

Ask AI to keep the calculation path

Suggested input: “Keep the original decimal values. State the rounding mode, decimal places and whether rounding happens per item or after summing. Show both totals if the rule is unspecified.” Review the values and the named rule before copying the table.

Do not repair the difference by changing a row

Keep original values separate from display values. If a report must reconcile rounded rows with a displayed total, ask the responsible owner which documented method to use. This example does not set an accounting, tax or billing rule.

Published October 14, 2026. Fictional arithmetic was tested with the existing Python 3.12.14 Decimal module. No spreadsheet, AI-generated table, invoice, accounting policy or real transaction was tested.

Sources: Python · Decimal.