|
Posted by Pedro Graca on 09/27/23 11:37
Chung Leong wrote:
> Palle Hansen wrote:
>> yawnmoth wrote:
>> > <?
>> > echo sprintf('%08x',0x40000000 >> 8)."\n";
>> > echo sprintf('%08x',0x80000000 >> 8);
>> > ?>
>> My guess is that PHP sees 0x8000000 as a *signed* integer
> No, PHP sees 0x80000000 as a double, because the number is beyond the
> range of an integer (on 32 bit systems).
Right, but the >> operator "casts" the float to an int.
~$ php -r '$x = 0x80000000; var_dump($x);'
float(2147483648)
~$ php -r '$x = 0x80000000 >> 0; var_dump($x);'
int(-2147483648)
--
If you're posting through Google read <http://cfaj.freeshell.org/google>
Navigation:
[Reply to this message]
|