You are here: Re: Difference of & in perl and php « PHP Programming Language « IT news, forums, messages
Re: Difference of & in perl and php

Posted by Jim Michaels on 11/09/01 11:42

<fritz-bayer@web.de> wrote in message
news:1141404106.485472.53880@z34g2000cwc.googlegroups.com...
> Hello,
>
> I'm porting a program from php to perl and discovered, that the bitwise
> operator & seems to work differently, which I don't understand why.
>
> I tested it with the values:
>
> a=5543039447 and b=13
>
> Then in perl the expressions:
>
> $result= ($z & $a);
>
> returns 2147483648.
>
> But in php the same expression returns zero. Why is that and how can I
> fix it?!
>
> Fritz
>

In my perl (ActivePerl 5.8.8.816 in WInXP 32-bit) I get 13 for a result.
5543039447=0x0000 0001 4A64 11D7
it's a 33-bit number, so that may be the cause of your problem right there.
undefined behavior after the bits get too big.

 

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

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