Bug #60346 [ReO]: NAN != NAN
| From: | yunosh@php.net | Date: | Mon, 21 Nov 2011 13:50:33 +0000 |
| Subject: | Bug #60346 [ReO]: NAN != NAN | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165400@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60346&edit=1
ID: 60346
Updated by: yunosh@php.net
Reported by: yunosh@php.net
Summary: NAN != NAN
Status: Re-Opened
Type: Bug
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 5.4.0RC1
Block user comment: N
Private report: N
New Comment:
You are right. I tracked a failing unit test with PHP 5.4.0RC down the wrong code path. The
regression is in a different place.
In PHP 5.3
abs(NAN - NAN) <= 0
evaluates to true, in PHP 5.4 it evaluates to false.
And if you wonder where this strange code is coming from:
https://github.com/sebastianbergmann/phpunit/blob/3.5/PHPUnit/Framework/Constraint/IsEqual.php#L363
This seems to have been worked around in later PHPUnit versions though.
Previous Comments:
------------------------------------------------------------------------
[2011-11-21 13:02:27] laruence@php.net
what do you mean by regression ?
I have tested in PHP 5.2.14, the same output as PHP 5.4
------------------------------------------------------------------------
[2011-11-21 12:58:03] yunosh@php.net
It's not documented (http://www.php.net/manual/en/math.constants.php) and it's still a
regression that isn't documented either: http://php.net/releases/NEWS_5_4_0_RC1.txt
------------------------------------------------------------------------
[2011-11-21 11:16:44] laruence@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
"x = x returning false can be used to test if x is a quiet NaN"
see: http://en.wikipedia.org/wiki/NaN
------------------------------------------------------------------------
[2011-11-21 10:15:11] yunosh@php.net
Description:
------------
This is a regression from PHP 5.3.
Test script:
---------------
var_dump(NAN == NAN);
Expected result:
----------------
bool(true)
Actual result:
--------------
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60346&edit=1