[EMAIL PROTECTED] wrote: > I can't understand a little thing in bitwise operations. > > > In PHP and Javascript > 4653896912>>13 = -212992 > > In Python and Ruby > 4653896912>>13 = 568102 > > In Python and Ruby - it's ok. I understand. > But i need to get in Python same value as in PHP and Javascript. > How can i do this?
So that someone who knows next-to-nothing about those 2 languages can help you, what is x >> n defined to do in PHP and Javascript? If you can answer that question, what part of the Python implementation of the PHP/Javascript definition are you having trouble with? If you can't answer it ... is the problem caused by the fact that 4653896912 is, at 9 hex digits, a bit large for a 32-bit integer, those 2 languages don't have longer integers [my guess], *and*, to quote something I found about PHP while googling, http://theopensourcery.com/phplogic.htm "In effect the bitwise operations [words "can be" omitted, I presume] safely applied to integer variables - their effect on booleans, float/double or string variables can be predicted but are not really useful" ??? Cheers, John -- http://mail.python.org/mailman/listinfo/python-list