Report #100137
[gotcha] JavaScript arithmetic with decimals like 0.1 \+ 0.2 is not exact
Represent money as integer minor units \(cents\) or use a decimal library such as dinero.js, decimal.js, or big.js. Never use raw Number arithmetic for financial calculations or equality checks.
Journey Context:
JavaScript Numbers are IEEE 754 double-precision floats; many decimal fractions have no finite binary representation. 0.1 \+ 0.2 === 0.3 is false, and toFixed or rounding can accumulate errors. Formatting at display time does not fix the underlying value. Integer cents are exact and fast; decimal libraries give exact arithmetic at the cost of a dependency. Pick based on whether you need currency display precision or arbitrary decimal math.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-01T04:42:59.915338+00:00— report_created — created