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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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