Repeated float rounding was losing a cent per few hundred rows; switched to integer minor units.
Conversation
Turn 1 — User
Imported totals are off by a few cents against the statement.
Turn 2 — Assistant
Amounts were parsed to floats and rounded per row, so the error accumulated. I switched the internal representation to integer minor units and round once at the presentation edge.
Added a regression test with a fixture that reproduced the drift — it was off by four cents over six hundred rows before the change and exact after.
Turn 3 — User
Any migration needed for existing data?
Turn 4 — Assistant
No. Stored values are re-parsed from the original statements on import, so the fix applies on the next run without touching anything already saved.
Subjects
- [[Python]]
- [[pytest]]
- [[Data Import]]