Bug #71032 [Ver]: Comparison of float NAN returns true

From: Date: Sat, 05 Dec 2015 03:01:09 +0000
Subject: Bug #71032 [Ver]: Comparison of float NAN returns true
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197610@lists.php.net to get a copy of this message
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 Assigned To: laruence Block user comment: N Private report: N New Comment: actually, it's not only compare_function, but also fast_is_smaller doesn't take care NAN well. https://3v4l.org/efjgU Previous Comments: ------------------------------------------------------------------------ [2015-12-05 02:34:25] laruence@php.net 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 ------------------------------------------------------------------------ [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

« previous php.bugs (#197610) next »