help with Log() function
| From: | Jon King | Date: | Fri, 28 Nov 2003 22:03:35 +0000 |
| Subject: | help with Log() function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-171305@lists.php.net to get a copy of this message | ||
Hello,
I'm having trouble getting a log formula to work. This forumla is supposed
to return the number of payment required zero out a loan balance.
<!------- snip --------------->
/*
n = - (LN(1-(B/m)*(r/q)))/LN(1+(r/q))
q = amount of annual payment periods
r = interest rate
B = principal
m = payment amount
n = amount payment periods
LN = natural logarithm
*/
$q = 12;
$r = 0.07;
$B = 150000;
$m = 733;
print -(log(1-($B/$m)*($r/$q)))/log(1+($r/$q));
<--- end snip ---->
It keeps returning a NaN. I've checked the syntax over and over, but to no
avail.
Any help would be appreciated
TIA
Jon