Calculation assistance.. :)
| From: | Stephen Johnson | Date: | Fri, 19 Sep 2008 19:34:19 +0000 |
| Subject: | Calculation assistance.. :) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-280547@lists.php.net to get a copy of this message | ||
OK.. Math is NOT my forte ...
I am converting a site from ASP to PHP ... And this calc is in the ASP Code
:
$nMonthlyInterest = $nRate / (12 * 100)
//' Calculate monthly payment
$nPayment = $nPrincipal * ( $nMonthlyInterest / (1 - (1 +
$nMonthlyInterest) ^ -$iMonths))
Which then gives me in PHP
0.0010416666666667 = 1.25 / (12 * 100);
-2.1701388888889 = 25000 * ( 0.0010416666666667 / (1 - (1 +
0.0010416666666667) ^ -12)) ::
^ is the problem ...
The solution SHOULD be 2,097.47 ... Not 2.17
Would be willing to help correct this and make it valid in PHP?
--
Stephen Johnson c | eh
The Lone Coder
http://www.thelonecoder.com
continuing the struggle against bad code
http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--