Tablora · Library
Check 0.10 plus 0.20 as exact decimals
Check that 0.10 plus 0.20 equals exactly 0.30 with decimal arithmetic, so a stated total is compared without floating-point display artifacts.
Why 0.1 plus 0.2 can look wrong
Many programs store numbers in binary floating point, where 0.1 and 0.2 have no exact representation. Add them and the stored result is a hair above 0.3; depending on formatting, you may see 0.30000000000000004 or a comparison that says the values are not equal. In a reconciliation, that kind of artifact looks like a discrepancy that is not really there.
The decimal totals checker avoids it. It reads each value as a decimal string, scales all values to the same number of decimal places and adds them as whole numbers, so 0.10 and 0.20 add to exactly 0.30.
Entering the lines
- Type or paste the amounts into Values, one per line. Blank lines are ignored and spaces around a value are trimmed.
- Use canonical decimal notation: an optional leading minus, digits, and a point before the fraction. Grouping commas, a decimal comma, a plus sign or a currency label are rejected.
- Put the figure you want to verify in Expected total, written the same way.
- Press Calculate and read Calculated total, Expected total, Difference and Totals match.
Result for 0.10 and 0.20
With the values 0.10 and 0.20 and an Expected total of 0.30, the Calculated total is 0.30, the Difference is 0.00 and Totals match shows Yes. The result keeps two decimal places because that is the largest number of places among the inputs and the expected total.
Difference is always Calculated total minus Expected total, so a negative difference means the entered lines fall short of the stated figure.
Preparing values from a real table
Amounts copied from a statement rarely arrive in canonical form. Run the column through the numeric normalizer first, choosing the decimal and grouping separators the document uses, then copy the converted values into the checker. A value the normalizer held for review is not ready for the sum; resolve it before you trust the total.
The checker does exact arithmetic on what you enter and nothing more. It does not convert currencies, apply tax or rounding rules, or tell you whether every record was entered.
Inputs the checker refuses
- 1,234.50 with a grouping comma, or 1234,50 with a decimal comma: convert them with the numeric normalizer first.
- +5.00 with a plus sign: enter 5.00.
- .50 without a leading zero: enter 0.50.
- (2.50) in parentheses: enter -2.50.
- Any one of these stops the whole calculation with Check the entered values and try again, so a bad line is never skipped silently.
Original synthetic example
- Values
- 0.10 0.20
- Expected total
- 0.30
- Calculated total
- 0.30
- Calculated minus expected
- 0.00