#32211 [NEW]: Hexadecimal integer value above 32-bit doesn't convert to float
| From: | osp at tinet dot org | Date: | Mon, 07 Mar 2005 01:24:35 +0000 |
| Subject: | #32211 [NEW]: Hexadecimal integer value above 32-bit doesn't convert to float | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-74996@lists.php.net to get a copy of this message | ||
From: osp at tinet dot org
Operating system: Linux and Windows XP
PHP version: 4.3.10
PHP Bug Type: Variables related
Bug description: Hexadecimal integer value above 32-bit doesn't convert to float
Description:
------------
Hexadecimal values that don't fit a 32-bit size are not converted to float
as specified on documentation:
"Integer overflow
If you specify a number beyond the bounds of the integer type, it will be
interpreted as a float instead."
This works for decimal numbers, but not hexadecimal.
Reproduce code:
---------------
<?php
$myvalue = 0x100000000; // 33-bit value
//$myvalue = 4294967296;
echo $myvalue."<br>";
var_dump( $myvalue );
?>
Expected result:
----------------
4294967296
float(4294967296)
(0x100000000)
Actual result:
--------------
2147483647
int(2147483647)
(0x7FFFFFFF)
--
Edit bug report at http://bugs.php.net/?id=32211&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32211&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32211&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32211&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32211&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32211&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32211&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32211&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32211&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32211&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32211&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32211&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32211&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32211&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32211&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32211&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32211&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32211&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32211&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32211&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32211&r=mysqlcfg