4 ms·
It would be a nice surprise to come across an article on COBOL that has anything nice to say, much less informative, about the language. One could start with th
by ibiza 8y ago
It would be a nice surprise to come across an article on COBOL that has anything nice to say, much less informative, about the language. One could start with that it's one of a tiny minority of languages based on decimal arithmetic as opposed to binary. This is kind of handy when dealing with money.
- labster 8y agoPerl 6 uses rational arithmetic by default (or by defining typed variables), which covers the money use case well. And, of course, we have SQL's DECIMAL type in most backends.
- nothrabannosir 8y agoAnd Common Lisp, although it’s not necessarily “default”. (/ 2 3) works as expected, but 1.7 is a float (unfortunately), and not a rational 17/100. Shame, really.
- Grue3 8y agoNothing unfortunate about that. When you work with rationals, it's very easy to grow incredibly large denominators, at which point all arithmetic operations slow to a crawl. Floats are fast and predictable, which is why they're used for most calculations in CL and other languages.
- AstralStorm 8y agoExcept when you hit denormals or underflow. Or accidentally lose precision ending up with a wrong result. If I could get a cent for every money transaction done on floats and incorrectly rounded, I'd be a billionaire.
- jjnoakes 8y ago17/10
- ofrzeta 8y agoThere you go: "The Beauty of the COBOL Programming Language" https://devops.com/the-beauty-of-the-cobol-programming-language-v2/ https://devops.com/the-beauty-of-the-cobol-programming-langu...
- pjc50 8y agoThe "PIC" syntax for variable declaration is an amazing idea that should be more widely copied. I'm also a fan of COBOL's use of '.' as a statement terminator instead of ';' like the ALGOL languages.