Off by one cent
A customer emails a screenshot: their invoice total reads £0.30000000000000004. Your accountant says the monthly totals are a few pennies off.
This answers: Why is my app's money total off by a cent? No coding needed. 3 quick decisions.
- Payments and webhooks
- Where your data lives
- Debugging without panic
Checking your access…
Why is my app's money total off by a cent?
Your app is probably storing or adding money as floating-point numbers, which cannot hold most decimals exactly: 0.10 + 0.20 gives 0.30000000000000004, and small errors add up. Store money as integer cents or an exact numeric type, do the maths in cents, and send payment integer amounts in the smallest unit.
Breaks at Database: Money stored as floating point
How it works
What the computer holds
0What the customer should see
£0.00
Why AI tools write this bug
Generated schemas and cart code often use a plain number or float column for prices, because it works perfectly with round test prices.
How to fix it
- Change money columns to integer cents or numeric.
3 more steps, and a prompt that checks your own app for this bug. Part of Pro.
UnlockCommon questions
- Is rounding to two decimals enough?
- It hides the symptom on screen, but sums and comparisons can still drift. Work in integer cents.