php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40439 bit shift error
Submitted: 2007-02-12 00:36 UTC Modified: 2007-02-12 10:05 UTC
From: xris01 at free dot fr Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.1 OS: Debian 3.1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: xris01 at free dot fr
New email:
PHP Version: OS:

 

 [2007-02-12 00:36 UTC] xris01 at free dot fr
Description:
------------
When using bit shifting (shift left) operation in 5.2.1, result is different (and false) compared to 5.1.6

Reproduce code:
---------------
$z = -2302452860;
$lr_z = (($z) << 4);

echo $lr_z;

Expected result:
----------------
1815459904

Actual result:
--------------
0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-12 06:29 UTC] judas dot iscariote at gmail dot com
/sapi/cli/php foo.php
-36839245760 64 bit system
 and 0 in 32 bit system here.
 [2007-02-12 09:23 UTC] tony2001@php.net
On 32bit systems -2302452860 is a float, not integer.

 [2007-02-12 10:05 UTC] xris01 at free dot fr
I see, but even though type is double, why are the result different ?
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 27 21:00:03 2025 UTC