# Interest rate function

has anybody got an example of using the interestrate function found in Math.pas.
The other financial functions work fine but when using the interestrate function my answer is different to what I would expect.
###### Who is Participating?

Commented:
>From the Delphi bug list:

There are no bugs in the InterestRate function in Delphi. People who reported it in the bug list have never done accounting or financial calcs using paper and pencil... or even an HP-48G.

The InterestRate function returns the value exactly as expected, and they match the results of the Financial solver of my HP-48GX exactly. The problem most people have is interpreting the results.

If you do what the InterestRate function does on the paper, using the conventional formulas, you'll also find opposite signs for PV and FV or PMT.

http://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=10356437
- or -

(it's a 5 pts question, but this function has been extensively discussed and the expect results have been found using the InterestRate function and some financial background).

>my answer is different to what I would expect.

You are probably expecting an interest rate in %/year.

The InterestRate function returns the rate in the time basis of the payment you entered. So, supposed you passed 60 as the number of payments, and you do consecutive monthly payments, then, that is 60 months, and the function will return the Interest rate in months. In order to have the yearly interest rate, multiply it by 12 (and then by 100 to have it in %).

This has all been explained in the thread I mentioned.

Yours,

Alex
0

Commented:
From the Delphi bug list:

Reported by Karl Thompson
InterestPayment gives wrong results; InterestRate causes Exceptions.
Karl has provided sample code with which the bugs can be reproduced.
Jean-Claude Valitchek has looked into these bugs and found that:

function InterestPayment() calls function PaymentParts() where var T3 goes from negative to zero then positive for a calculation from the first to the last period, which is wrong...!

function InterestRate():
As described in the unit (not in the HELP!), First and last payments must be non-zero and of OPPOSITE SIGNS. When this is applied, the function works.

Hope this helps.

0

Author Commented: