ID:               48418
 Updated by:       ka...@php.net
 Reported By:      phplists at stanvassilev dot com
 Status:           Open
 Bug Type:         Math related
 Operating System: Linux, BSD, possibly all *nix
 PHP Version:      5.2.9
 New Comment:

C:\php\src>php -v
PHP 5.3.0RC3-dev (cli) (built: May 29 2009 09:57:23)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies

C:\php\src>php -r "$nan = sqrt(-1); var_dump($nan, $nan > $nan, $nan <
0, $nan > 0);"
float(NAN)
bool(true)
bool(true)
bool(true)

Same on Windows


Previous Comments:
------------------------------------------------------------------------

[2009-05-28 19:05:20] phplists at stanvassilev dot com

And to add a note:

$NaN >= $NaN
$NaN >= 0
$NaN <= 0

These also return true and must return false.

------------------------------------------------------------------------

[2009-05-28 18:57:57] phplists at stanvassilev dot com

Description:
------------
Tested on Gentoo, CentOS, OSX. 

This is possibly NOT related to the Windows NaN bug, as Windows is NOT

affected by this issue. 

However, please test if any fix doesn't cause regression on Windows.

NaN > NaN, NaN > 0, NaN < 0 return true, while they should return false

in all cases (any comparison where either side is NaN, should return 
false).

Reproduce code:
---------------
$NaN = sqrt(-1);
var_dump($NaN > $NaN);
var_dump($NaN > 0);
var_dump($NaN < 0); 

Expected result:
----------------
float(NAN)
bool(false)
bool(false)
bool(false)

Actual result:
--------------
float(NAN)
bool(true)
bool(true)
bool(true)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48418&edit=1

Reply via email to