hey guyz... im trying to convert this formula into java code, im just having difficulty understanding it... ok it goes like this:
Given loan amount (denoted by a), monthly interest rate as a decimal number (denoted by r). and monthly payment (denoted by p), the loan duration (in months) can be determined by the formula
Duration = ceil ( -log(1 - ar / p) / log(1 + r) )
where ceil(x) is the smallest integer which is bigger or equal to x.
im not to sure about the ceil part but would the rest of the formula look like this:
int a = 0 //Loan amount
double r = 0 //Interest rate
double p = 0 //Monthly Payment
int duration = 0 //Loan duration
ceil = ????
duration = ????((-log(1-((a*r)/p)))/(log(1+r))
please feel free to forward any suggestions...