The most expensive bug in a money system is usually off by one cent.
Not wrong. Off by a rounding unit. That distinction is exactly why it gets through code review.
Take a payout split pro rata across several investors. Each share gets computed, each gets rounded, and the sum of the rounded shares no longer equals the amount that actually arrived. The gap is a cent. Tests written with round numbers pass. Nothing throws. No request fails. Your dashboards stay green.
The gap still has to go somewhere. If the ledger does not assert that debits equal credits inside the same transaction that writes the entries, something absorbs it quietly: a user balance, a fee line, a rounding account nobody owns. It does not blow up once. It accrues per transaction and surfaces during reconciliation against what the bank actually settled, usually long after the fact.
That is the real cost. The fix is not a patch, it is replaying history to work out which balances drifted and by how much, while the money has already moved.
So: integer minor units, no floats. One authoritative total, with the remainder allocated by an explicit rule instead of dropped. And the balance invariant checked in the write path, not in a nightly job.
A bug is dangerous in proportion to how quietly the system can absorb it. Financial systems absorb a cent beautifully.
Worth knowing where your system asserts that the money math balances: at write time, or the next morning...