Bug #77389 [Opn->Nab]: NAN is not correctly defined in binary representation on Windows

From: Date: Mon, 31 Dec 2018 12:58:42 +0000
Subject: Bug #77389 [Opn->Nab]: NAN is not correctly defined in binary representation on Windows
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218707@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77389&edit=1 ID: 77389 Updated by: nikic@php.net Reported by: fghamsary at v3d dot fr Summary: NAN is not correctly defined in binary representation on Windows -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: Windows PHP Version: 7.2.13 Block user comment: N Private report: N New Comment: This is just a difference between positive and negative NaNs. Both are legal NaN values and functionally identical. PHP does not guarantee the sign, quietness or payload of the NaN returned by the NAN constant. Previous Comments: ------------------------------------------------------------------------ [2018-12-31 12:48:56] fghamsary at v3d dot fr Description: ------------ I tested this code with different versions of php 5.6, 7.1 and 7.2 and it's the same with all. PHP 7.2.13 (cli) (built: Dec 5 2018 07:19:53) ( NTS MSVC15 (Visual C++ 2017) x64 ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies PHP 7.2.6 (cli) (built: May 23 2018 20:29:37) ( NTS MSVC15 (Visual C++ 2017) x64 ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans PHP 5.6.36 (cli) (built: Apr 25 2018 16:45:32) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies PHP 7.1.18 (cli) (built: May 24 2018 17:54:03) ( NTS MSVC14 (Visual C++ 2015) x64 ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans Test script: --------------- function printBytes($bytes) { foreach (str_split($bytes) as $b) printf('%02x ', ord($b)); echo "\n"; } printBytes(pack('d', (double)NAN)); printBytes(pack('f', (float)NAN)); Expected result: ---------------- 00 00 00 00 00 00 f8 7f 00 00 c0 7f Actual result: -------------- 00 00 00 00 00 00 f8 ff 00 00 c0 ff ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77389&edit=1

« previous php.bugs (#218707) next »