Decimal can still hide a mismatch in a reconciliation script.
I caught this in my own synthetic CSV-check sample. The row values differed, but the totals reported a zero difference. No customer data was involved.
Reproduce it in Python:
from decimal import Decimal, localcontext, Inexact
x = Decimal("1000000000000.000000000000000001")
y = Decimal("1000000000000.000000000000000002")
with localcontext() as ctx:
ctx.prec = 28
print(sum([y], Decimal(0)) - sum([x], Decimal(0)))
ctx.prec = 32
ctx.traps[Inexact] = True
print(sum([y], Decimal(0)) - sum([x], Decimal(0)))
Outputs: 0E-15, then 1E-18.
Constructing Decimal from a string preserves those digits. Arithmetic still uses the active context's precision, including adding the first value to sum's zero start. The rounding occurred in the totals before subtraction.
32 digits is sufficient for this example; it is not a universal setting. For other inputs, account for the range of magnitudes, decimal places and possible carries. Keep Inexact trapped when silent rounding is unacceptable; handle intentional rounding separately under the agreed rules.
In my sample, the correction calculates the needed precision and rejects excessive spans. Regression checks now cover this tiny difference, cancellation, and the unchanged original fixture. Passing those checks does not validate anyone else's accounting rules.
Python's explanation: https://docs.python.org/3/library/decimal.html
For a bounded check of a CSV/JSON discrepancy, scope and acceptance criteria are agreed first: https://xmrbazaar.com/listing/jwQr/