Chromatix wrote:
There are functions of currency values that are used in financial applications that are easier to handle in floating point, such as the compound-interest exponential function (to take a relatively familiar example). But my understanding is that some jurisdictions literally mandate the use of *decimal* floating point for these purposes when money is involved. I think this is so that the computer's calculations can be precisely audited by hand calculation when required.
I remember I spent weeks trying to get a large GL report to balance that did lot of distributions across accounts. You know, one of those reports that's 2 inches thick, thousands of transactions, and on the last page read something like:
Totals: Gazintas: $123,347,345.32 Gazouttas: $123,347,345.31
ARGH!
I was adding stuff up, detecting "missing" pennies, trying to allocate them appropriately.
I don't know if that thing ever balanced. Boy, was it frustrating.
Would decimal math have helped? Eh, I honestly don't know. But, it probably wouldn't have hurt.
(All we had was floating point, we didn't even have integer math on that system. And, yes, I was rounding, truncating, multiplying by 100, rounding/truncating, then dividing by 100 to try and get rid of "hidden bits". I did everything I could think of at the time save adding up string variables...)