Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Monthly payment algorithm

Status
Not open for further replies.

DerPflug

Programmer
Mar 28, 2002
153
US
I'm trying to get a monthly payment algorithm to work but I seem to be messing up with the order of precedence or something. I'm not sure. The algorithm is:

(P * R * (1 + R)^L)/((1 + R)^L - 1)

P = principal = $1000
R = interest rate = %10
L = length of loan = 12 months

With these values the monthly payment should be 87.92.

I currently have:
payment = (P * R * pow(1 + R,L))/(pow(1 + R,L) - 1);
but this doesn't seem to work. Any ideas?
 
Are you sure your expected result is right?

On my calculator I got 146.76.


[sub]I REALLY hope that helps.[/sub]
Will
 
I just realized what I was doing wrong. The Rate needs to be divided by twelve before its inserted into the equation.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top