It's an amazingly pervasive myth taught in CS 101 courses that "you should never use floating point types for currencies, or you might go to jail". In reality floats are fine for most financial applications, and for almost all those that would find themselves in a spreadsheet.
Even in accounting a certain rounding error is accepted depending on the size of the company. And for pricing financial instruments, prices pretty much always get rounded on the execution (you will never communicate a price with 20 decimals to a client on the phone). Excel rounding is a non problem in finance. Except when you are making exact payments. But payment systems aren’t run in excel anyway.
> It's an amazingly pervasive myth taught in CS 101 courses that "you should never use floating point types for currencies, or you might go to jail". In reality floats are fine for most financial applications, and for almost all those that would find themselves in a spreadsheet.
I think that if anyone ever needs to give me 12 quadrillion dollars (more than a million dollars for every human alive), they can keep the extra 21 dollars.
I'm not unfamiliar with the idea that floating point numbers have a limited precision, I'm saying the precision is normally good enough.
> I think that if anyone ever needs to give me 12 quadrillion dollars (more than a billion dollars for every human alive), they can keep the extra 21 dollars.
You're missing the point. You don't need a 1-cent error for a smaller error to throw things off. Say someone owes you $0.30 and pays you $0.10 and $0.20. If the data type inherently has 2 digits past the decimal, or if you just do everything with integers, then they'll be debt-free by the end and nothing will go wrong. But if you're representing these with binary floats, then you have to remember to explicitly do rounding at precisely the correct intermediate spots in order to avoid incorrectly listing them as still having a balance. Even for a programmer it's too easy to either put it or forget to put it in the correct spot, let alone for a non-programmer writing the sheet.
And that's just one example. I'm sure there are tons more I can't think of off the top of my head. It's not like people made the decimal data types for nothing.