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

From: Date: Sat, 05 Dec 2015 01:44:51 +0000
Subject: Bug #71032 [Opn->Ver]: Comparison of float NAN returns true
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197604@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:         requinix@php.net
 Reported by:        obouda at email dot cz
 Summary:            Comparison of float NAN returns true
-Status:             Open
+Status:             Verified
 Type:               Bug
-Package:            Unknown/Other Function
+Package:            Variables related
-Operating System:   Windows
+Operating System:   
 PHP Version:        7.0.0
 Block user comment: N
 Private report:     N

 New Comment:

https://3v4l.org/XRDRs


Previous Comments:
------------------------------------------------------------------------
[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)

« previous php.bugs (#197604) next »