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
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: 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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 21:01:34 2025 UTC