On Fri, 8 Apr 2022 at 03:16, Christopher Barker <pythonchb@gmail.com> wrote:
I'm no accountant, but this strikes me as quite dangerous -- sure decimal fractions are exact, but who says you are only doing decimal arithmetic? Calculating interest, inflation, who knows what could easily introduce non-exactly-representable-in-decimal numbers. And do accounting systems really use floating point decimal dollars, rather than, say fixed point or integer cents? I also notice that in the financial world, there's a lot of use of binary fractions: interest rates tend to be in eights of a percent, not tenths of a percent, for example.
Good question; but I do know that one limitation of the classic "use integer cents for money" solution is that you can't do forex that way. Right now, for instance, one AUD is worth 0.74770 USD (although while I typed that, it changed to 0.74773 USD). Would have to ask someone in high finance about that; do they think in terms of fixed point still (ie there's always precisely 1000 subdivisions of a cent), or do they think in terms of individual transactions ("here, I'll sell you 29_852_359 AUD, you give me 22_320_610 USD") and what we call exchange rates is all just rounded anyway? Decimal floating-point certainly has its uses, but it isn't the perfect solution to all things financial. But then, NOTHING is the perfect solution to all things financial, as evidenced by the state of the world we're in.... ChrisA