Posted by Oli Filth on 10/06/55 11:42
CrashRoX said the following on 15/03/2006 10:32:
> Here's some confusion for you...
>
> <?PHP
> $x = (4653896912 >> 13);
> echo $x;
> ?>
>
> I ran that on two different servers.
>
> Server A gave me: 43814
> Server B gave me: 568102
>
> I have been hacking away and researching this for hours. I am
> completely clueless. Any suggestions or workarounds? Thanks in advance.
>
4653896912 is bigger than can be represented as a signed-int on a 32-bit
platform, so gets truncated to 358929616. And (358929616 >> 13) == 43814.
However, 4653896912 can be represented as a signed-int on a 64-bit
platform, giving the "correct" answer of 568102.
[NOTE: I haven't checked this to see if it's right though...]
--
Oli
Navigation:
[Reply to this message]
|