3 ms·
This is a useful bit of conventional wisdom, but it helps to know when it is and isn't applicable. There is a huge amount of data analysis which uses numbers r
by samatman 2y ago
This is a useful bit of conventional wisdom, but it helps to know when it is and isn't applicable.
There is a huge amount of data analysis which uses numbers representing money as inputs where it's fine to use floating point, and financial entities routinely do so. For a transaction, interest payments, and that sort of thing, then yes, one needs a specific sort of fixed-point representation, and operations which round in whatever the legally-correct fashion is for the use case.
Reductively, if you've turned money into numbers, and will turn the resulting numbers back into money, don't use floating point. If you're running a big calculation with lots of inputs to decide what stock to buy next, that's probably going to have floating-point monetary values in it, and there's nothing wrong with that. Hedge funds do a lot of the latter.