php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #33933 64bit signed integer support on 32bit platforms
Submitted: 2005-07-31 01:33 UTC Modified: 2020-02-07 20:25 UTC
Votes:13
Avg. Score:4.5 ± 1.2
Reproduced:11 of 12 (91.7%)
Same Version:5 (45.5%)
Same OS:7 (63.6%)
From: php at aornis dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.1.0b3 OS: Any 32bit platform
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: php at aornis dot com
New email:
PHP Version: OS:

 

 [2005-07-31 01:33 UTC] php at aornis dot com
Description:
------------
Better support for 64bit integers would be very nice, for example when performing this operation:

$val = 0x1 << 32;
echo $val;

The value "1" is returned, due to the 32bit wrapping applied to the integer. Even when using type casts to float or double it doesn't extend beyond 32bits.

An extra type such as Int64 would be very useful.

Reproduce code:
---------------
$val = 0x1 << 32;
echo $val."\n";

(float)$val = (float)0x1 << 32;
echo $val;

Expected result:
----------------
It should output "4294967296" for both

Actual result:
--------------
It outputs "1" due to 32bit wrapping

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-08 23:43 UTC] ajf@php.net
The bigints RFC would resolve this on 32-bit platforms: http://wiki.php.net/rfc/bigint
 [2016-12-30 22:57 UTC] cmb@php.net
-Package: Feature/Change Request +Package: Scripting Engine problem
 [2020-02-07 05:46 UTC] carusogabriel@php.net
Is this one still valid? Looks like it was already fixed: https://3v4l.org/76F5g.
 [2020-02-07 05:52 UTC] requinix@php.net
-Summary: 64bit signed integer support +Summary: 64bit signed integer support on 32bit platforms
 [2020-02-07 05:52 UTC] requinix@php.net
I think we can wontfix this: 64-bit is the norm, and bc/gmp are available to anyone who needs numbers larger than their system supports.
 [2020-02-07 20:25 UTC] php at aornis dot com
-: detonator316 at gmail dot com +: php at aornis dot com -Status: Open +Status: Closed
 [2020-02-07 20:25 UTC] php at aornis dot com
I filed this 15 years ago, it was a different time :) Closed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 17:01:30 2024 UTC