#47774 [Opn->Bgs]: Integer Overflow
| From: | mattwil@php.net | Date: | Wed, 25 Mar 2009 16:15:17 +0000 |
| Subject: | #47774 [Opn->Bgs]: Integer Overflow | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-135116@lists.php.net to get a copy of this message | ||
ID: 47774
Updated by: mattwil@php.net
Reported By: vivekanandan8 at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Debian
PHP Version: 5.2CVS-2009-03-25 (snap)
New Comment:
This is the expected behavior. Happens because it's not parsed as a
single negative number, but a positive number (and 2147483648 needs to
be a float) that is then negated afterwards. So it's treated more like
-(2147483648). Hope that helps explain what's going on. :-)
Previous Comments:
------------------------------------------------------------------------
[2009-03-25 14:28:33] vivekanandan8 at yahoo dot com
Description:
------------
Generally when integer number exceed(overflows), it is converted to
float,But for the number -2147483648 the Integer can hold, but converted
to float.
Reproduce code:
---------------
<?
$vValue = (int)-2147483648;
var_dump($vValue);
$vValue = -2147483648;
var_dump($vValue);
?>
Expected result:
----------------
int(-2147483648) int(-2147483648)
Actual result:
--------------
int(-2147483648) float(-2147483648)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47774&edit=1