Doc #65852 [Opn]: Wrong documentation about NAN comparison.
| From: | chalkerx at gmail dot com | Date: | Mon, 07 Oct 2013 17:48:03 +0000 |
| Subject: | Doc #65852 [Opn]: Wrong documentation about NAN comparison. | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-10442@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65852&edit=1
ID: 65852
User updated by: chalkerx at gmail dot com
Reported by: chalkerx at gmail dot com
-Summary: Fileinfo file() method and any mp3 file crashes php.
+Summary: Wrong documentation about NAN comparison.
Status: Open
Type: Documentation Problem
Package: Documentation problem
Operating System: Linux
PHP Version: 5.5.4
Block user comment: N
Private report: N
New Comment:
Whoops, browser-saved title from the old bug.
Previous Comments:
------------------------------------------------------------------------
[2013-10-07 17:46:00] chalkerx at gmail dot com
Description:
------------
http://www.php.net/manual/en/types.comparisons.php
states:
> Some numeric operations can result in a value represented by the constant NAN. Any loose or
> strict comparisons of this value against any other value, including itself, will have a result of
> FALSE
But that is invalid, because NAN loosely equals to boolean true.
Test script:
---------------
var_dump(sqrt(-1));
var_dump(sqrt(-1) == true);
Expected result:
----------------
As per documentation, the result should be:
double(NAN)
bool(false)
The documentation should be consistent with what actually happens.
Actual result:
--------------
double(NAN)
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65852&edit=1