Doc #65852 [Com]: Wrong documentation about NAN comparison.

From: Date: Wed, 09 Oct 2013 09:23:36 +0000
Subject: Doc #65852 [Com]: Wrong documentation about NAN comparison.
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10465@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 Comment by: phpmpan at mpan dot pl Reported by: chalkerx at gmail dot com 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: As documentation states, conversion from NaN to boolean should yield TRUE, and hence TRUE == TRUE will be TRUE too. I believe the wording is just not precise and "value" means "numeric value" in this case. Of course this needs to be fixed. Previous Comments: ------------------------------------------------------------------------ [2013-10-07 17:48:03] chalkerx at gmail dot com Whoops, browser-saved title from the old bug. ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#10465) next »