mirror of
https://github.com/Such-Software/wownerogue.git
synced 2026-10-17 14:21:25 +02:00
Money is integer atomic units, but payout and sum math ran on float64 (`Math.round(base * multiplier)`, `sum + Number(x)`), which silently loses precision above 2^53 — a real risk for large/credit/XMR amounts. - Add src/money/atomic.js: the single source of truth for atomic-unit math (toBig, toSafe, sum, add, mulByDecimal, format). mulByDecimal multiplies an atomic amount by a decimal multiplier using exact integer arithmetic with half-up rounding; toSafe narrows to a number only when exactly representable and otherwise returns a decimal string. - calculatePayout now uses money.mulByDecimal/toSafe instead of float math. - walletRPCService batch total + fee sum use money.sum instead of float reduce. Adds moneyAtomic.test.js with property tests on amounts above 2^53 proving exactness where the old float path drifted. Full suite: 14 suites / 129 tests.