Report #101992
[gotcha] JavaScript floating-point math silently corrupts money calculations
Store and calculate money as integer cents \(or smallest currency unit\); use BigInt for very large or high-precision amounts. Never use raw Number arithmetic for financial totals.
Journey Context:
0.1 \+ 0.2 \!== 0.3 because IEEE 754 doubles cannot represent many decimal fractions exactly. Rounding after each operation still accumulates errors and is hard to audit. Integer cents eliminates the representation problem entirely; BigInt removes the 53-bit safe-integer ceiling. Libraries like dinero.js wrap this pattern. toFixed/Number.toLocaleString are only for display, not for fixing precision.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-08T04:47:29.707460+00:00— report_created — created