Float precision loses cents

On-call incidentMedium35 minStripe style

Your task

Finance flags that a small fraction of ledger rows have amount values off by a fraction of a cent, e.g. 19.99 stored as 19.989999999999998, and a few aggregations now disagree with the source by a few cents per million dollars. Started after a Friday schema change. Dashboards: no errors, no failed writes, transaction volume normal. Context: a migration 'cleaned up' the amount column on Postgres from NUMERIC(12,2) to double precision to 'make math faster', and the app's ORM now round-trips the value through a 64-bit float before writing. How do you triage, stop the drift, and recover correctness?

It covers

  • Float precision
  • Money
  • Type change
  • Silent rounding