Hacker News new | ask | show | jobs
by RcouF1uZ4gsC 2022 days ago
One thing I have heard about COBOL is that it has a built in, decimal fixed point type. Very few of the modern languages have an native type like this. Having a decimal fixed point type makes monetary calculations easier to do more reliably.
2 comments

> One thing I have heard about COBOL is that it has a built in, decimal fixed point type. Very few of the modern languages have an native type like this..

What modern language doesn’t have either fixed-point or arbitrary-precision decimals (or both) in either the core language or standard library?

I mean, sure, C doesn’t (and I don’t think C++ does), but those aren’t particularly modern languages.

In don’t think that Java fits the bill either in this regard. White it does have BigDecimal in the standard library, it is both slower(because object and supports arbitrary precision) and more cumbersome (no operator overloading ) than a native type.
I can see a case for decimal floating point types, but fixed point adds nothing beyond what can be performed directly via arithmetic on the underlying integers. It's basically a convenience feature.
Most things in modern programming languages are convenience features; loops are basically if+goto etc.