logoalt Hacker News

librastevetoday at 4:34 PM2 repliesview on HN

This is great news if you are coding accounting/banking software and good to see the IBM standards referenced. Given that decimal32 starts to see gaps in the continuous dollars.cents range at about $100,000 I don’t expect that has many real world applications (except legacy compatibility).

For general applications, I prefer to use Rational representation for decimals (Rat or FatRat) and Allomorphs (RatStr, FatRatStr) to maintain a literal representation like this https://raku.land/zef:librasteve/FatRatStr.


Replies

exabrialtoday at 8:07 PM

I always use fixed point decimals for accounting. Floating points are approximations of decimals, which is the exact opposite what you want while accounting.

Useful for say, simulating aerodynamics or weather, not useful for precision tasks.

jmalickitoday at 6:00 PM

Do you encounter things where fixed point isn't good enough? (I.e. always store cents or millis etc?)

Or is the flexibility of not having to choose an advantage?