Discussion about this post

User's avatar
Arslan Ahmad's avatar

Chained float errors are underappreciated as an interview topic too, because variants of this decide real incidents. The classic is the Patriot missile clock drift, 0.1 has no exact binary form, the error accumulated every tick, and after a hundred hours the intercept window had moved by hundreds of meters. The practical rules I teach engineers. Money in integer cents. Time in integer ticks. Comparisons with an epsilon, never raw equality. Kahan summation when the list is long. Floats are fine, trusting their 15th digit across a million operations is not. Great series Franco.

Abhishek Pan's avatar

Same thing bites data pipelines. Spark sums doubles per partition and then merges the partial sums, so the same SUM over the same table can change in the last digits when the partitioning changes, and a reconciliation check that compares totals for exact equality starts failing with nothing actually wrong. Keeping money columns as DECIMAL avoids most of it.

1 more comment...

Ready for more?