Re: Bug #14134 Updated: Literal -2147483648 should be an int, not a double.
| From: | Pierre-Alain Joye | Date: | Tue, 20 Nov 2001 08:41:49 +0000 |
| Subject: | Re: Bug #14134 Updated: Literal -2147483648 should be an int, not a double. | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-71023@lists.php.net to get a copy of this message | ||
> 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.
pa