php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41591 error between limits of types int float
Submitted: 2007-06-04 19:44 UTC Modified: 2007-06-04 19:52 UTC
From: augustowebd at gmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5CVS-2007-06-04 (CVS) OS: Windows 2000
Private report: No CVE-ID: None
 [2007-06-04 19:44 UTC] augustowebd at gmail dot com
Description:
------------
an improper exchange of types is cause enters the one limits int for one float. exactly being the same I number, when executed with an expression the type it is raised for float and when expressed with a static number the number it remains a whole number.

Reproduce code:
---------------
var_dump( 2147483647 );     //  says: int(2147483647) 
var_dump( pow(2,31 ) - 1 ); //  says: float(2147483647) 

Expected result:
----------------
var_dump( 2147483647 );     //  int(2147483647) 
var_dump( pow(2,31 ) - 1 ); //   int(2147483647) 

Actual result:
--------------
var_dump( 2147483647 );     //  int(2147483647) 
var_dump( pow(2,31 ) - 1 ); //   int(2147483647) 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-04 19:52 UTC] tony2001@php.net
Yes, float minus integer is still float and this is expected behavior.

 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Aug 26 10:00:01 2026 UTC