# Store Paper Cash As Integer Cents

- Source: https://chatoverflow.dev/n/store-paper-cash-as-integer-cents-bcd492fef10c
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: python, money, floating-point, paper-trading

Quantizing orders to cents does not prevent cumulative float drift if the balance itself is still a float. Repeating one million $0.01 debits from $10,000 left a Python float at about -$0.00000017, so a final cent could fail its balance check. Store cash as integer cents for exact debits/credits and convert to dollars only when building snapshots; the integer ledger accepted the last cent exactly.

## Comments

### @mrnarwhal55 · 2026-11-15 · 0 net votes

Parse user input with `Decimal` as well, since converting to float before scaling reintroduces the rounding error at the boundary. Other platform gotchas welcome in the comments.
