top of page

Why Can Decimal Quantities Change Slightly Between Business Tools?

Oct 23
3 min read
Preserve Exact Decimal Quantities Across Tools: Define exactness needs; Preserve the representation; Test the full round trip.

An imported quantity looks correct on screen but differs slightly when another system compares it. The display may hide extra digits, while the calculation uses an approximate internal value. Choosing a number type is therefore part of the business contract.


First decide whether the quantity represents an exact decimal amount, a count or an approximate measurement. The answer determines what kind of arithmetic and comparison are appropriate.


Distinguish representation from formatting


PostgreSQL's numeric-type documentation distinguishes exact numeric and decimal types from inexact floating-point types. It defines precision as the total significant digits and scale as the fractional digits.


Formatting a value to two decimal places does not change how it was calculated upstream. Likewise, storing an exact decimal in the database does not protect it if an integration converts it through an approximate representation before saving.


Document the complete path: input control, request format, parser, application calculation, database and export. Find every conversion boundary rather than inspecting only the final column type.


Choose exactness around the task


Whole-item counts may use integers. Decimal quantities with a fixed business meaning may need decimal arithmetic or scaled integers. Approximate physical measurements may reasonably use floating point when their precision and comparison rules are understood.


Do not select a universal tolerance merely to make failing tests pass. A permissible difference should come from the measurement or business requirement. Equality rules for a reference identifier also differ from equality rules for a measured quantity.


When using a scale, define units explicitly. An integer representing hundredths of an hour is not the same as an integer representing minutes.


Illustrative example: allocated work time


A fictional planning tool accepts allocations in tenths of an hour. It combines 1.2 hours and 2.3 hours and expects an exact decimal total of 3.5 hours within that contract.


The test checks the request, stored values, arithmetic result and exported representation. Showing “3.5” in the interface is insufficient if an intermediate conversion changes the value used by a downstream comparison. This is a data-handling example, not a billing or compensation policy.


Define limits and invalid input behavior


Specify the maximum supported magnitude, permitted scale and handling of additional fractional digits. Choose whether excess precision is rejected or rounded under a documented rule.


Include negative values, zero, missing values and unsupported notation in the test set. Decide whether a quantity outside the business range should fail even when it fits the storage type.


Keep the raw submitted value available only where appropriate for diagnosis, and separate it from the accepted normalized value. This helps explain corrections without making every downstream consumer repeat the parsing rules.


Verify the round trip


Send known fixtures through the actual integration path, then export and reimport them. Compare semantic values using the chosen representation rather than relying on text appearance alone.


Test repeated addition, subtraction and a boundary near the maximum supported value. Include calculations that require rounding and verify where that rounding occurs. Exact storage cannot make a recurring fraction finite, so division still needs an explicit precision policy.


Record the field, unit, representation at each boundary, allowed scale, rounding point, expected result and observed result. Link failures to the conversion that introduced them.


A reliable quantity contract preserves meaning across tools. It makes deliberate approximations visible and prevents a formatting choice from masquerading as evidence of numerical correctness.


Continue with When Should Your Workflow Round a Measurement? for the related planning decision.


FutureOS is in prelaunch. Use this guide to prepare a concrete project discussion; the published introduction describes the current project context.



Prepared with AI assistance. Primary sources checked on October 23, 2026. Examples and procedures are illustrative editorial guidance, not FutureOS product announcements or an independently reviewed assessment.

Recent Posts

See All

Comments


bottom of page