php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30577 (int)float truncation
Submitted: 2004-10-27 07:21 UTC Modified: 2004-10-27 11:06 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: rick at gibbed dot us Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.2 OS: win32
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: rick at gibbed dot us
New email:
PHP Version: OS:

 

 [2004-10-27 07:21 UTC] rick at gibbed dot us
Description:
------------
On the Windows platform any form of casting done to a float that can fit in an integer that is above 0x7FFFFFFF gets truncated to 0x7FFFFFFF rather than assuming the actual signed integer value.

Reproduce code:
---------------
$v = 2147483648; // 0x80000000
var_dump((int)$v);

Expected result:
----------------
int(-2147483648) // 0x80000000

Actual result:
--------------
int(2147483647) // 0x7FFFFFFF

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-27 11:06 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 04:01:33 2024 UTC