note 75124 deleted from language.types.float by bjori
| From: | bjori@php.net | Date: | Thu, 27 Sep 2007 12:31:49 +0000 |
| Subject: | note 75124 deleted from language.types.float by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-130847@lists.php.net to get a copy of this message | ||
Note Submitter: chrisgbk at hotmail dot com
----
>>rune at zedeler dot dk
>>05-Mar-2007 06:44
>>Comparing infinite values gives REALLY STRANGE results.
>>INF<INF is true
>>INF>INF is true
>>INF==INF is false
>>INF===INF is true
>>So if someone tells you that $a==$b implies $a===$b then you can tell them no, $a=$b=INF is
>>a counterexample. :-/
The above is incorrect.
You have to remember, that INF is not a discrete value, it is more or less a flag indicating a
state: "Infinity" does not necessarily mean that the result is actually infinite. It
simply means "too large to represent"(From Wikipedia). Moreover, INF cannot ever be equal
to INF, as the following example shows:
(+INF) + (+7) = (+INF)
For INF==INF to be true, (INF + 7)==INF would also have to be true due to the above; it is not,
again, because INF is not a value, it is a state.
Furthermore, logically, $a=$b=INF is not a counterexample; it would be if INF==INF was true but
INF===INF was false(or if you had said $a===$b implies $a==$b), but this is not the case, as
implication is not a two-way street. Following is a truth table for p => q:
p q p=>q
F F T
F T T
T F F
T T T
So we have:
INF==INF (implies) INF===INF
False (implies) True
True (from the truth table above)
thus, $a=$b=INF is not a counterexample, since the system remains logically consistant.