A
Andrew Savige
The operator precedence table at:=0A=0A http://phrogz.net/ProgrammingRuby/l=
anguage.html#table_18.4=0A=0Astates that the exponentiation operator (**) h=
as higher precedence than=0Athe complement operator (~). Ditto for operator=
precedence in Python.=0A=0AYet the following program:=0A=0A x =3D ~2**3=0A=
print x, "\n" # prints -27 in Ruby; prints -9 in Python=0A=0Asurprise=
d me by printing -27 (I am using ruby 1.8.6).=0A=0ABTW, the following progr=
am prints -9 in both Ruby and Python:=0A=0A x =3D ~(2**3)=0A print x, "\n"=
=0A=0AIs this a Ruby bug?=0A=0AThanks,=0A/-\=0A=0A=0A The new Internet=
Explorer 8 optimised for Yahoo!7: Faster, Safer, Easier.
anguage.html#table_18.4=0A=0Astates that the exponentiation operator (**) h=
as higher precedence than=0Athe complement operator (~). Ditto for operator=
precedence in Python.=0A=0AYet the following program:=0A=0A x =3D ~2**3=0A=
print x, "\n" # prints -27 in Ruby; prints -9 in Python=0A=0Asurprise=
d me by printing -27 (I am using ruby 1.8.6).=0A=0ABTW, the following progr=
am prints -9 in both Ruby and Python:=0A=0A x =3D ~(2**3)=0A print x, "\n"=
=0A=0AIs this a Ruby bug?=0A=0AThanks,=0A/-\=0A=0A=0A The new Internet=
Explorer 8 optimised for Yahoo!7: Faster, Safer, Easier.