engineering deep dive

A rounding mode does not choose when to round

Exact amounts, explicit rounding and the point at which rounding occurs answer different engineering questions.

PUB-0012 · FinKore · 4 min read · No publication date asserted

Bounded editorial interpretation; source limitations retained; not independently validated

Two calculations can use the same rounding mode and target scale yet produce different totals because precision was reduced at different points. Naming the mode is necessary. It does not describe the entire sequence.

This is a useful distinction when a financial integration says it “uses HALF_UP” as though that alone identifies its policy. Which values were rounded? At which boundary? Was an exact intermediate retained? The answers can matter as much as the familiar mode name.

One deliberately small illustration

Consider two exact amounts of 0.005 EUR. This is a hypothetical educational example, not a report about an invoice, tax rule or deployed implementation. Deliberate rounding uses target scale 2 and HALF_UP throughout.

SequenceExact reasoningFinal amount
Round each, then addEach 0.005 becomes 0.01; add those two results.0.02 EUR
Add exactly, then roundThe exact sum is 0.010; deliberate rounding to scale 2 preserves its value.0.01 EUR

The difference is one cent. It does not arise from choosing a different tie rule. The two sequences ask that rule to act on different values. Neither sequence is presented as the required accounting policy for a real transaction. A composing domain must decide where precision reduction belongs and explain the consequence.

Exact arithmetic is a separate operation

Money Arithmetic requires exact representable results to remain exact. Under MONEY-ARITHMETIC-007 and MONEY-ARITHMETIC-008, arithmetic cannot silently apply an assumed rounding rule. The hypothetical first sequence contains explicit rounding operations before addition; it is not permission for addition itself to reduce both operands.

The rounding specification separately defines scale and mode. It permits an explicitly declared domain policy, while forbidding a currency's customary scale from silently replacing the requested calculation scale. A display convention does not choose the two sequences above.

The distinction also matters for division. A supplied division policy applies when the quotient has no exact finite decimal representation. Under MONEY-ARITHMETIC-011, an exact quotient stays exact even if that policy requests a coarser scale. Dividing 1 EUR by 4 therefore has the exact value 0.25 EUR; a coarser policy does not silently make it a separate rounding operation.

Mode names still need observable checks

Locating the boundary does not make mode semantics unimportant. DOWN and FLOOR provide a compact counterexample to the idea that familiar names are interchangeable. For the exact rational quotient -1/3, target scale 2 yields -0.33 with DOWN and -0.34 with FLOOR. DOWN goes toward zero; FLOOR goes toward negative infinity.

These observations are already published as the paired money.divide.negative-down-001 and money.divide.negative-floor-001 cases in rounded division vectors. They are expected observations, not results of a run performed for this article. The repository validates their artifacts and traceability; a consumer supplies the implementation and execution.

A comparison using only positive inputs can miss the substituted mode. A comparison using only a final aggregate can miss the changed rounding boundary. The defect a case can expose depends on the differences its input makes observable. That is a reason to select cases deliberately, not a claim that two examples exhaust every rounding problem.

Four questions for a review

First, identify the exact values before precision reduction. Second, identify which operation is allowed to reduce precision. Third, record the target scale and mode at that boundary. Fourth, inspect a case that would differ if the boundary or mode changed.

Those questions do not require one implementation architecture. They require a shared account of the observable sequence. They also leave application policy with its owner: this article introduces no tax, settlement or invoice rule and no implicit policy-precedence mechanism.

A useful rounding statement is consequently more than “we use HALF_UP.” It identifies where that choice applies, which values it acts on and what evidence would reveal an accidental change. Exact arithmetic and explicit rounding can then be evaluated as distinct decisions rather than blended into a formatter.

Sources

Citing this publication

FinKore. A rounding mode does not choose when to round. PUB-0012. Publication date not recorded. Canonical URL: https://finkore.dev/article-rounding-boundaries.html.

Cite original studies for their findings; cite this publication for its own interpretation. Existing licensing and third-party rights remain in force.

All public publications · Challenge a claim or suggest a correction