Bug #51274 [Com]: Integer overflow does not cast as float

[email protected] ("ssufficool at gmail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
Edit report at http://bugs.php.net/bug.php?id=51274&edit=1

 ID:               51274
 Comment by:       ssufficool at gmail dot com
 Reported by:      cduncan at regatta dot com
 Summary:          Integer overflow does not cast as float
 Status:           Open
 Type:             Bug
 Package:          *General Issues
 Operating System: Linux
 PHP Version:      5.3.2

 New Comment:

64 bit ubuntu 10.04 PHP 5.3 SVN:
int(2147483647)
int(2147483648)

32 bit machine and OS PHP 5.2.10:
int(2147483647)
float(2147483648)


Previous Comments:
------------------------------------------------------------------------
[2010-03-11 19:05:31] cduncan at regatta dot com

64bit machine, 32bit OS.
Also, wouldn't we expect a 64bit to return:

int(2147483647)
int(2147483648)

------------------------------------------------------------------------
[2010-03-11 17:58:30] [email protected]

Could it possibly be that you're running this on 64bit machine? :)

------------------------------------------------------------------------
[2010-03-11 15:15:38] cduncan at regatta dot com

Description:
------------
The manual (http://php.net/manual/pl/language.types.integer.php)
includes the following segment to cover integer overflow:

<?php
$large_number =  2147483647;
var_dump($large_number);
// output: int(2147483647)

$large_number =  2147483648;
var_dump($large_number);
// output: float(2147483648)
?>

However when I try this on my recently upgraded server they are both
output as int(2147483647)

Test script:
---------------
$large_number =  2147483647;
var_dump($large_number);

$large_number =  2147483648;
var_dump($large_number);


Expected result:
----------------
I expect to see;

int(2147483647)
float(2147483648)

As I do on my box running 5.3.1


Actual result:
--------------
int(2147483647)
int(2147483647)



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51274&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.