php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77389 NAN is not correctly defined in binary representation on Windows
Submitted: 2018-12-31 12:48 UTC Modified: 2018-12-31 12:58 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: fghamsary at v3d dot fr Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.2.13 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fghamsary at v3d dot fr
New email:
PHP Version: OS:

 

 [2018-12-31 12:48 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-12-31 12:58 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2018-12-31 12:58 UTC] nikic@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 23:01:30 2024 UTC