When Political Decisions Raise Java Exceptions

Preparing another example for the AngularFaces showcase I just noticed a funny thing: the current period of low interest rates is a challenge to programmers!

Decades of banking apprentices learned how to calculate the monthly payment rate of a loan like so:

(see Wikipedia)

or translated to Javascript code:

var q = 1 + (interestRate / 100);
var annuity = amount * Math.pow(q, loanTerm) * (q - 1) 
             (Math.pow(q, loanTerm) - 1);

These days many interest rates are very close to zero per cent. Sometimes they even reach the 0 per cent mark, and that’s where the problem arises: traditional formulas fail because of the singularity. A DivisionByZeroExcetion is raised.

Of course it’s pretty simple to solve the bug. But I guess hardly anybody thought of crashing computer programs when the Bank of Japan lowered it’s interest rates to zero. That’s more than a decade ago, but still, the story might repeat now that both US fund rates and ECB refinancing interest rate are close to zero:

Source: Wikipedia

As I mentioned, it’s not a big deal to solve the problem. The bottom line it has to be solved by someone (computer programmers, to be precisely) – and it’s a nice example of unexpected side effects of decision done by politician and managers. I suppose many people aren’t aware of those side effects, and they’d be pretty surprise to learn how much money many decisions they consider harmless cost. Mind you, every financial institute has to correct their software to be able to cope with a zero interest rate!

Actually that’s not a new phenomenon. Many programmers become very busy when new laws are passed or important treaties are changed. For instance, my companies work is based on a collected labor agreement, and most changes of the treaty have to be mapped by our software.

But of course I’m not one to complain. I’m making my living solving those problems :).

Leave a Reply

Your email address will not be published.