Tablora · Library
Keep small decimal contributions visible
Add 1.2 and 0.003 exactly to get 1.203. The checker keeps the largest decimal scale it sees, so small contributions are never rounded away.
Values with different decimal places
Real data mixes precision: a unit price with three or four decimals, a fee rounded to cents, a quantity in whole numbers. When these are added in a tool that formats results to two places, a small contribution such as 0.003 can vanish from the displayed total, and two totals that differ in the third decimal look the same.
The decimal totals checker works out the largest number of decimal places among all values and the expected total, scales every value to that, and adds them exactly. Nothing is rounded, and the result is shown with that full scale.
The scale includes the Expected total. If you enter 1.20300 there, every figure in the result is shown to five decimal places, even though no line has that many.
Adding 1.2 and 0.003
The page example enters 1.2 and 0.003 in Values, one per line, with an Expected total of 1.203. The Calculated total is 1.203 and the Difference is 0.000, so Totals match shows Yes. The result has three decimal places because 0.003 and the expected total both have three.
Notice that the difference is shown as 0.000, not 0. The scale of every figure in the result is the same, which makes small gaps easy to read.
Entering mixed-precision values
- Copy each value with all of its digits; do not shorten 0.003 to 0.00 because the source column is formatted to two places.
- Write a leading zero before a fraction. A value like .003 is not accepted.
- Use a point as the decimal mark and no grouping separators; convert other notations with the numeric normalizer first.
- Check the scale of the Calculated total. If it has more decimals than you expected, one of the values is more precise than the rest.
- Keep trailing zeros if the source shows them. 1.20 and 1.2 are the same amount, but the extra digit changes the scale of the result.
Rounding belongs to a separate step
Keeping the scale is a property of exact arithmetic, not a financial rounding policy. If the figure you are checking against was rounded to cents, decide first whether the source rounded each line or only the total, and apply that rule yourself before comparing. The checker will then show whether the rounded figure matches.
The numeric normalizer behaves the same way for single values: it keeps the fraction digits that were written, so 125.00 stays 125.00 and 0.003 stays 0.003 rather than being shortened.
Original synthetic example
- Values
- 1.2 0.003
- Expected total
- 1.203
- Calculated total
- 1.203
- Calculated minus expected
- 0.000