3 ms·
The type system is a programmer's best friend
- raydiatian 4y agoIt does kill one that there isn’t a “money” type in pretty much any relevant language released in the last 40 years.
- raxxorraxor 4y agoAs a basic type next to float? I don't know. But there should be at least a type for such calculations on the next higher level. Or build in operations for float that round correctly within a strictly defined precision that is more abstract than it is for floats (decimal places).
- raydiatian 4y agoThe argument for it is that fintech is a gigantic sector, and that COBOL has a currency data type primitive. COBOL doesn’t require floating point numbers to do fractional maths when handling currency types (don’t quote me, can’t recall when I last read about cobol).
- thesuperbigfrog 4y ago>> Or build in operations for float that round correctly within a strictly defined precision that is more abstract than it is for floats (decimal places). Fixed point types? https://en.m.wikipedia.org/wiki/Fixed-point_arithmetic https://en.m.wikipedia.org/wiki/Fixed-point_arithmetic https://learn.adacore.com/courses/intro-to-ada/chapters/fixed_point_types.html https://learn.adacore.com/courses/intro-to-ada/chapters/fixe...