Loading section...

The FLOAT Money Bug

FLOAT and DOUBLE store numbers in binary scientific notation. They cannot represent 0.1 exactly, just like 1/3 cannot be represented exactly in decimal. This is not a bug. It is how IEEE 754 floating-point works. The problem is that financial calculations accumulate these tiny errors across millions of rows until someone notices that the monthly revenue report is off by $4,700. The $0.01 rounding error does not matter on one row. On 50 million payment transactions per month, it compounds to thousands of dollars that cannot be reconciled with the bank statement. When FLOAT Is Actually Fine FLOAT is not universally bad. It is the wrong choice for money, but the right choice for sensor readings, GPS coordinates, scientific measurements, and ML feature values where approximate representation i