LOGBOOK

HELP

Quiz Entry - updated: 2026.07.07

What is the difference between unsigned and signed division using right shift?

Unsigned division by 2^k is a logical right shift; signed uses an arithmetic right shift — but the arithmetic shift rounds toward −∞, not toward zero like C's /.

For unsigned division:

u >> k  ==  u / 2^k  (truncates toward 0)

For signed division (negative numbers):

x >> k  rounds toward -∞, not toward 0!
-7 >> 1 = -4  (but -7/2 should be -3)

Problem: C division truncates toward zero, but arithmetic shift rounds toward negative infinity.

From Quiz: REVE1 / Number Representations | Updated: Jul 07, 2026