Multi-way mortgage calculator

,

There are thousands of mortgage calculators on the web that let you compute a monthly payment based on a capital sum, interest rate, and duration. That’s fine for the common decision about whether you can afford a house, borrowing at a standard interest rate and duration. But sometimes you want to compute in other directions:

  1. You might know the maximum monthly payment you can afford and want to see how big a loan you can afford to service (that is, you want to compute capital from rate, duration and payment).
  2. You might want to know how high interest rates can go before you’ll be unable to afford the repayments (that is, you want to compute rate from capital, duration and payment).
  3. Or your lender lets you overpay by £500 a month and you want to know how quickly you can pay off your loan (that is, you want to compute duration from capital, rate and payment).

So I give you the multi-way mortgage calculator:

Compute what?
Capital
Interest rate Headline: %   =   APR: %
Duration years   =   months
Monthly payment
Loan type

Warning. Your home may be at risk if you do not keep up repayments on your mortgage. Every lender seems to have their own method of rounding so don’t expect numbers to match to the penny. If the calculator gives you an infinite duration, that’s because your scenario is negatively amortizing. Lenders still pretend that their annual rate is twelve times the monthly interest rate, as though digital computers had never been invented and it were too much trouble to raise a number to a power.

Some background. The rules for calculating APR in the UK were introduced by the Consumer Credit Act 1974 and are summarized in this leaflet from the Office of Fair Trading. This is rather fine as government publications go: it contains pseudo-code for using bisection and Newton’s methods to iteratively find an APR. Much better than the FSA’s non-attempt to explain APR.

The OFT leaflet says, “The APR is the correct mathematical result given by the statutory equation, expressed as a percentage and rounded to one decimal place.” (my emphasis). For example, here’s a mortgage product from Nationwide: There are no fees to complicate matters, so we can be reasonably sure that the APR is really 6.952…% and has been rounded up to 7.0%.


Update 2008-03-26: This stuff is harder than it looks:

if (payment <= capital * (monthly_rate - 1)) {
    // Rounding the payment (down) to the nearest penny has
    // accidentally turned an amortizing loan into a negatively
    // amortizing one, so round the other way.
    payment += 0.01
}