Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

the other big cobol feature is high precision (i.e. many digest) fixed point arithmetic. not loosing pennies on large sums, and additionally with well defined arithmetics, portably so as you point out, is a killer feature in finance.

you need special custom numerical types to come even close in, say, java or C++ or any other language.



>the other big cobol feature is high precision (i.e. many digest) fixed point arithmetic. not loosing pennies on large sums, and additionally with well defined arithmetics, portably so as you point out, is a killer feature in finance.

I guess you mean:

>digest -> digits

>loosing -> losing

Is that the same as BCD? Binary Coded Decimal. IIRC, Turbo Pascal had that as an option, or maybe I am thinking of something else, sorry, it's many years ago.


There are some regulations in bond pricing or international banking or stuff like that that require over 25 decimal places. IIRC, the best COBOL or whatever could do on the IBM 360's was 15 digits. The smaller, cheaper, and older 1401 business machines didn't have any limit. Of course, for nerdy financial applications, compound interest and discounting of future money would require exponentiation, which was damn-near tragic on all those old machines. So was trying to add or subtract 2 numbers that were using the maximum number of digits, but with a different number of decimal places, or trying to multiply or divide numbers that each used the maximum number decimal places, with the decimal point in various positions, and it was suicide-adjacent to try to evaluate any expression that included multiple max precision numbers in which both multiplication and division each happened at least twice.


> There are some regulations in bond pricing or international banking or stuff like that that require over 25 decimal places.

Sounds interesting. Is there anywhere you know I can read about it, or is there something specific I can search for? All results I'm getting are unrelated.


Sorry, not that I know of. They never let me near that stuff, and the various really important standards bodies are monopoly providers of information, so they inevitably charge more for copies of their standards than non-subservients like me can afford. I just tried to quickly scan the 25,000+ ISO standards and did not find anything even possibly related under $100. The Securities Industry Association was the maven of bonds when I was trying to figure them out, but, knock me over with a feather, they were dissolved almost 20 years ago. You might start with the Basel Committee on Banking Supervision, the Financial Markets Standards Board, the Bank for International Settlements, the Fixed Income Clearing Corporation, or https://www.bis.org/publ/mktc13.pdf.


Binary Coded Decimal is something else.

1100 in “regular” binary is 12 in decimal.

0001 0010 in BCD is 12 in decimal.

ie: bcd is an encoding.

High precision numbers are more akin to the decimal data type in SQL or maybe bignum in some popular languages. It is different from (say) float in that you are not losing information in the least significant digits.

You could represent high precision numbers in BCD or regular binary… or little endian binary… or trinary, I suppose.


yes and... bcd arithmetics are directly supported on CPUs for financial applications, like Z:

IBM z Systems Processor Optimization Primer

https://share.google/0b98AwOZxPvDO6k15


thx for the typo fixes

indeed, it's exactly BCD arithmetics which are part of the standard, with fixed decimal size and comma position

and yes, Turbo Pascal had some limited support for them.

you needed them in the 1990s for data exchange with banks in Germany. "Datenträgeraustauschformat". data storage exchange format. one of my first coding gigs was automatic collection of membership fees. the checksum for the data file was the sum of all bank account numbers and the sum of all bank ID numbers (and the sum of all transferred amounts)... trivial in Cobol. not so much in Turbo C++ :-)

I wasn't aware of the BCD in turbo Pascal... those were the days :-D


welcome.

those were the days, indeed :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: