The operator precedence table at:
states that the exponentiation operator (**) has higher precedence than
the complement operator (~). Ditto for operator precedence in Python.
Yet the following program:
x = ~2**3
print x, “\n” # prints -27 in Ruby; prints -9 in Python
surprised me by printing -27 (I am using ruby 1.8.6).
BTW, the following program prints -9 in both Ruby and Python:
x = ~(2**3)
print x, “\n”
Is this a Ruby bug?
The new Internet Explorer 8 optimised for Yahoo!7: Faster, Safer,