You are here: Re: confusing >> results « PHP Programming Language « IT news, forums, messages
Re: confusing >> results

Posted by Jerry Stuckle on 09/27/97 11:37

Chung Leong wrote:
> Palle Hansen wrote:
>
>>yawnmoth wrote:
>>
>>>Using >> normally shifts bits to the right x number of times, where x
>>>is specified by the programmer. As an example, 0x40000000 >> 8 yields
>>>0x00400000. This makes me wonder... why doesn't the same thing happen
>>>with 0x80000000 >> 8? The number it yields is 0xff800000 - not
>>>0x00800000. The following script better demonstrates this:
>>>
>>><?
>>>echo sprintf('%08x',0x40000000 >> 8)."\n";
>>>echo sprintf('%08x',0x80000000 >> 8);
>>>?>
>>>
>>>Anyway, any ideas?
>>
>>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).
>

No, 0x80000000 is exactly 32 bits and is taken as a signed integer.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация