4 ms·
Well, if your decimals are fixed-point decimals, which is the case in finance, decimal calculations are very cheap integer calculations (with simple additional
by ernst_klim 7y ago
Well, if your decimals are fixed-point decimals, which is the case in finance, decimal calculations are very cheap integer calculations (with simple additional scaling in multiplication/division).
I just use Zarith (bignum library) in OCaml for decimal calculation, and pretty content with performance.
I don't think much domains needs decimal floating point that much, honestly, at least in finance and scientific calculations.
But I could be wrong, and would be interested in cases where decimal floating-point calculations are preferable over these done in decimal fixed-point or IEEE floating-point ones.
- qwerty456127 7y agoWhy doesn't everybody do it this way then? We would probably have a transparent built-in decimal type in every major language by now if there were no problems with this.
- ernst_klim 7y ago> Why doesn't everybody do it this way then? Why? Fintech uses decimal fixed-point all the way, there are libraries for them for any major language. Apps like GnuCash or ledger use them as well.
- qwerty456127 7y agoBut Java has BigDecimal in its standard library and it's soooo slow I doubt it is implemented this way.