RE: [PHP] Math Weirdness
| From: | Jay Blanchard | Date: | Tue, 15 Jul 2008 15:16:54 +0000 |
| Subject: | RE: [PHP] Math Weirdness | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-276841@lists.php.net to get a copy of this message | ||
[snip]
for most of what the majority of php/script apps deal with, it's
probably
safe to assume that addition/subtraction will be safe, but i can think
of
numerous examples where this isn't true...
[/snip]
As demonstrated by the example I provided, just checking the difference
(or lack thereof) between two floats brought the issue to light.
I think that this falls into the same category that cleaning input data
does in the fact that it should always be done. While there is a joke
about "skimming" the diffs it just demonstrates that the mathematical
constructs we use based on a digital platform leaves room for
error...and the errors add up really quickly because the platforms are
so darn much quicker than we are.