Re: Math Weirdness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 14, 2008 at 1:39 PM, Jay Blanchard <jblanchard@xxxxxxxxxx> wrote:
> I am totally buffaloed by a set of very simple calculations that I am
> doing;
>
>                $totChargeDiff = $endingBal - $totalCharges;
>                echo number_format($totChargeDiff, 2, '.', '')."\t";

    You're performing math to get the result for $totChargeDiff by
subtracting $totalCharges from $endingBal.  That will give you -0.10
in this case, because 0.10 - 0.20 = -0.10.  You want the difference,
not the result.

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux