RE: Math Weirdness

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

 



[snip]
Isn't it possible then that your data is out of synch between the
current balance and the previous day's ending balance?
[/snip]

No, the values are there and correct (it is done with a snapshot). The
correct numbers are being used in the math (as shown). When I do
this....(as you suggested);

if(abs($totBalDiff - $endingBal) < .000001){
		echo "OK\t";
	} else {
		/* what is the difference between the ending balance and
the charges? */
		$totChargeDiff = $endingBal - $totalCharges;
		echo number_format($totChargeDiff, 2, '.', '')."\t";
	}

You can see the abs value difference is extremely small and it causes
things to work as expected. 0.1 should be equal to 0.1

-- 
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