RE: [PHP] Math Weirdness
| From: | Robert Cummings | Date: | Mon, 14 Jul 2008 19:40:09 +0000 |
| Subject: | RE: [PHP] Math Weirdness | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-276774@lists.php.net to get a copy of this message | ||
On Mon, 2008-07-14 at 14:29 -0500, Jay Blanchard wrote:
> [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
So does that mean your problem is solved?
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP