Report #98260
[gotcha] Binary floating point cannot exactly represent common decimals, so 0.1 \+ 0.2 \!== 0.3 and comparisons like 0.1 \+ 0.2 === 0.3 silently fail
Store and calculate money as integer minor units \(e.g. cents\) or use BigInt/BigDecimal-style libraries. If you must round for display, use Intl.NumberFormat or an arbitrary-precision decimal library; never use Number for financial arithmetic.
Journey Context:
JavaScript Numbers are IEEE-754 double-precision binary64. Many decimal fractions have no finite binary representation, so rounding errors accumulate. The fix of Math.round\(\(a \+ b\) \* 100\) / 100 papers over the problem and still fails on edge cases. BigInt handles integers but not decimals; dedicated decimal libraries model the problem domain correctly. The integer-cents pattern is the standard for financial code because it maps directly to ledger entries and avoids representation issues.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-27T04:40:01.087613+00:00— report_created — created