Original URL: http://www.theregister.co.uk/2006/08/14/rounding_issues/
We only use above average programmers here...
Floating point and legacy
A number of people have commented that "nobody" uses Floating Point in financial calculations, for all the reasons Dan Clarke went into in his recent article on Floating Point and rounding issues.
But it seems to me that this misses the point. Yes, I'm old enough to remember when IBM mainframes, and its COBOL, supported BCD (binary coded decimal) and, since I was working for a bank, our coding standards warned you about Floating Point and rounding/truncation effects generally.
So, lots of languages and hardware today support decimal arithmetic and other relatively safe ways of doing financial calculations - but who tells programmers to employ them? Who, for that matter, reads (or writes) coding standards manuals?
Well, some people do and some places will (possibly more sensibly) see training courses as a more effective alternative to standards manuals, but floating point arithmetic, in the wrong place, is still a bug waiting to happen.
Surely, the common assumptions that "all our programmers are above average" (really? are you sure? do you have any metrics for this?) and "no-one competent enough to be employed here would ever do that" are exactly what give rise to the sort of expensive bugs that pop up in the Risks Digests and embarrass everyone?
I once worked for a bank that only employed above average people. One of them decided to write a new date routine using 9s complement arithmetic, so that dates were stored/retrieved in some "right" order - but he couldn't do 9s complement arithmetic himself reliably.
Then, there was the guy that could write database locks more efficiently than IBM could - but forgot to issue any unlocks. I doubt either of these people lasted long, they were pretty much "below average", but some people can write a lot of code in three months or so - I wonder how much of it is still there in this bank's systems...
Although, perhaps it is pretty safe by now. That is one of the good things about legacy systems – like old houses, if they haven’t already fallen over and been abandoned, they’ve settled into rock-solid stability over the years. Although, like old houses, they can be tricky to maintain...®