Code RoomFloat precision loses cents
MediumPrep Room Coding #2684

Float precision loses cents

On-callReliability & on-callMid–Senior~35 min

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?

What a strong answer looks like

Stop the bleeding first (mitigate), then form hypotheses from real signals. Separate root cause from symptom, communicate status as you go, and close with what prevents a repeat.

0:00 of about 35 min
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.