On Tue, 20 Nov 2001, Pierre-Alain Joye wrote: > > When assigning the value -2147483648 to a variable, the variable becomes a double, >even though the value is within the range of integers. In fact, assigning -2147483647 >- 1 works, as does using intval("-2147483648"). > > > > The following script demonstrates, and can be accessed at ><http://www.randomsample.org/tests/test-int-min.php>. > > > > <?php > > $int_max = 2147483647; > > $int_min = -2147483648; > > $int_min_alt = -2147483647 - 1; > > 2^31 = 2147483647 > If I m not wrong, php code integer on 32bits, 1 bit for the sign, interval will be >-2147483647 (2^31). > As the docs say, double will be used for larger integer values.
You're not correct, the smallest number that should fit in into a signed integer is -2147483648. -(2^31) The highest number is 2147483647. (2^31) - 1 Derick --------------------------------------------------------------------- PHP: Scripting the Web - www.php.net - [EMAIL PROTECTED] SRM: Site Resource Manager - www.vl-srm.net --------------------------------------------------------------------- -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]