Originally posted by Bert Bates:
candy -
It seems to me Lasse's explanation is a great start - do you understand his answer? It seems that your formula for dividing by 2 to the N isn't really the best way to think about this topic - you really have to look at the binary.
bit shifting operations are integer operations, not floating point.
Therefore if you take a floating point division to determine the answer you will need to take into consideration as the result ONLY the integer part of the resulting floating point number.
And even then you have to consider that the result is invalid when you're doing a bitshift operation on a negative number.
Examples (using 8 bit ints for brevity).
-1 >> 1 == 10000001 >> 1 == 01000000
-1 >>> 1 == 10000001 >>> 1 == 11000000
Neither of which is equal to -1/2 == -0.5 (the int part of which is -0 )