137k views
3 votes
It was demonstrated in Example 2.5 from the textbook that shifting a binary number one bit to the left is equivalent to multiplying the number by 2. What operation is performed when a binary number is shifted one bit to the right

User Gameweld
by
3.0k points

1 Answer

3 votes

Answer:

Evaluation of the integral part of the quotient of division by 2

Explanation:

If shifting left by 1 bit is equivalent to multiplying by 2, it may seem intuitive to assume shifting right by 1 is equivalent to division by 2.

Consider the binary representation of 6: 110

Shifting right removes the last binary digit, so we have 11 which is binary of 3, indeed a division by 2.

Now, consider 101. This is 5 in binary. Shifting right by 1 bit removes the last 1, leaving 10, which is binary of 2. But we know 5÷2 = 2.5, not 2. What has happened is that the binary digits are integer representations. The fractional part has been truncated because it cannot be represented as an integer. This is why the shift operations work very well with integers.

Shifting right by 1 bit, then, truncates the fractional part of the result of division by 2, leaving the integral part.

User Tom Mac
by
3.2k points