Report #104669
[gotcha] Using floating-point arithmetic \(Number\) for monetary calculations leads to rounding errors, e.g., 0.1 \+ 0.2 \!== 0.3.
Represent monetary values as integers in the smallest unit \(cents\) using BigInt or use a decimal library like decimal.js. Avoid toFixed for rounding; use integer math.
Journey Context:
IEEE 754 double precision cannot represent many decimal fractions exactly. Common workarounds include rounding after each operation, but errors accumulate. Using integer cents avoids floating point entirely. Libraries like decimal.js are safer but add dependency. BigInt is native but requires scaling.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-27T20:05:25.182239+00:00— report_created — created