3 ms·
Floats are used in finance for many applications. Most of the front office applications I've worked on use floats for money, because it's like science: the mode
by bidirectional 5y ago
Floats are used in finance for many applications. Most of the front office applications I've worked on use floats for money, because it's like science: the model is already off by more than floating point error.
The whole "NEVER use floats for money" thing is cargo culting. In this situation though I don't see why floats would be any better a solution than just using 64-bit integers.
- jschwartzi 5y agoIt's more accurate to say "never use floats for accounting." You should be able to state with 100% certainty how much money you owe no matter how much money you owe.
- klyrs 5y agoNot 100%. There's gotta be a precision cutoff somewhere between $1 and the inverse of Avogadro's number.
- jschwartzi 5y agoI'll cede this point. If you're accounting for the quantity of pennies down to the precision of individual penny atoms then your accounting must be accurate to within the quantity of penny atoms that are rubbed off the penny during normal handling during the transaction.