Using floating-point numbers for money
Of course you <i>can</i>, but for the vast majority of cases, you <i>shouldn’t</i>. Floating points aren’t designed to solve the problems financial calculations bring, they’re designed for general purpose math and efficiency.<p>If you’re programming a point-of-sale system, or a ecommerce site or something, using IEEE-754 floats would be madness. The increase in performance compared to decimal types is absolutely infinitesimal, and the cost of getting it wrong is MASSIVE. Just don’t do it!<p>Of course, if you really do need the performance advantage floats offer (e.g. high-frequency trading or machine learning), then by all means, use floats. But that’s a tiny minority of those programmers who have to deal with money.