0

I really don't understand why two same inputs give 2 different results. Can anyone tell me why this:

$t=0;
$c=0;
$p = 151000;
    while ($t<=144) {
        if ($t%12 == 0) {
            $p = $p*(1 -((1 + 0.00833333333) ** $t - 1)/((1 + 0.00833333333) ** 144 - 1));

            echo "<br>".$c."&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; .round($p);
            $c = $c+1;
        }
        $t = $t+1;
    }
}

when $t is 24 the result is : 130347

but when I write JUST TO CHECK THE RESULT: $p = $p*(1 -((1 + 0.00833333333) ** 24 - 1)/((1 + 0.00833333333) ** 144 - 1));

the result is: 136554

Two identical values give two different results. Thanks in advance.

Zotov
  • 265
  • 1
  • 8
  • 20
  • 1
    When you replace `$t` with `24`, `$t = $t + 1` no longer affectes anything. – u_mulder Oct 08 '17 at 16:05
  • They are completely different situations I am talking about the results which should be the same and they are not. – Zotov Oct 08 '17 at 16:19

0 Answers0