Bug #71032 [Ver]: Comparison of float NAN returns true
Edit report at https://bugs.php.net/bug.php?id=71032&edit=1
ID: 71032
Updated by: laruence@php.net
Reported by: obouda at email dot cz
Summary: Comparison of float NAN returns true
Status: Verified
Type: Bug
Package: Variables related
PHP Version: 7.0.0
Block user comment: N
Private report: N
New Comment:
that is because fast_is_smaller_* behaviors differently on IS_DOULBE IS_DOUBLE pair from
compare_function.
actually, PHP-5.6 has the same issue if opcache is enabled
Previous Comments:
------------------------------------------------------------------------
[2015-12-05 01:44:51] requinix@php.net
https://3v4l.org/XRDRs
------------------------------------------------------------------------
[2015-12-04 21:20:46] obouda at email dot cz
Description:
------------
Comparison of the float NAN value to any other value is supposed to return false - as the docs of
the float type says.
In PHP 5.4 to 5.6 the result is false, as expected.
In PHP 7.0, the comparison returns true.
Reproduced on Windows 7 (64bit) as well as at https://3v4l.org/GkqZZ
Test script:
---------------
<?php
var_dump(NAN < 1.0);
Expected result:
----------------
bool(false)
Actual result:
--------------
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71032&edit=1
Thread (6 messages)