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?
(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?