note 75124 added to language.types.float
| From: | chrisgbk at hotmail dot com | Date: | Mon, 14 May 2007 01:17:07 +0000 |
| Subject: | note 75124 added to language.types.float | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126571@lists.php.net to get a copy of this message | ||
>>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.
----
Server IP: 66.207.199.35
Probable Submitter: 68.151.136.226
----
Manual Page -- http://www.php.net/manual/en/language.types.float.php
Edit -- https://master.php.net/note/edit/75124
Del: integrated -- https://master.php.net/note/delete/75124/integrated
Del: useless -- https://master.php.net/note/delete/75124/useless
Del: bad code -- https://master.php.net/note/delete/75124/bad+code
Del: spam -- https://master.php.net/note/delete/75124/spam
Del: non-english -- https://master.php.net/note/delete/75124/non-english
Del: in docs -- https://master.php.net/note/delete/75124/in+docs
Del: other reasons-- https://master.php.net/note/delete/75124
Reject -- https://master.php.net/note/reject/75124
Search -- https://master.php.net/manage/user-notes.php