My coding agent stored prices as floats. 3 invoices came out a cent off.
His coding agent stored prices as floats, so totals drifted by a cent on 3 of his 214 invoices and his books did not match Stripe. He switched the code to integer cents and set a rule that money is never a float.
This one went wrong. Read what happened so you don’t hit the same problem.
How it works
- Coding agent stores prices as floats
- Summing line items drifts totals by a cent on 3 of 214 invoices
- His books no longer match Stripe
- He finds it and switches to integer cents, with a rule that money is never a float
Why it’s worth knowing
The agent code ran fine and still quietly broke his books, by one cent on 3 invoices, until Stripe did not match.
Where it’s from
Summarized from a public post on bsky.app. See the original ↗