In general, what does the location of the rightmost “1” in a binary number tell you? Is it different for positive and for negative numbers?

799 Views Asked by At

In general, what does the location of the rightmost “1” in a binary number tell you? Is it different for positive and for negative numbers?

2

There are 2 best solutions below

0
On BEST ANSWER

Like in base $10$, the rightmost zeros are an indication of divisibility by the base. For example, in base $10$, $300$ is divisible by $10^2$.

Take an arbitrary number in binary: $N=1100101110101001100000$. By the way, in decimal it's $3336800$. The rightmost $1$ is here the coefficient of $2^5$ in the development $N=\sum_{i=0}^{\infty} a_i2^i$, hence the number is divisible by $32=2^5$.

This is valid for both positive and negative numbers, since for example $-3336800$ is simply written $-1100101110101001100000$ in binary.

The representation in Two's complement has nothing (or just a little bit) to do with the sign of an integer. However, since in this representation a negative number $-a$ is represented as $2^M-a$, the meaning of the rightmost $1$ bit is the same.

0
On

For positive numbers, the right-most (i.e. the least significant) bit tells you the remainder you get when dividing by $2$ (the base is $2$ in binary, of course).

So if that bit is $0$, the number is evenly divisible by $2$ (a.k.a. an even number). If that bit is $1$, the remainder upon dividing by $2$, is $1$ (a.k.a. an odd number).

For negative numbers, you must tell us how you write them in binary. If you just put a minus sign in front of the digits, clearly it is just like positive numbers (parity is conserved by negating). If you use the two's complement, for example, it is easy to see that again the least significant bit gives the parity ($0$ means even, $1$ means odd). There are other conceivable ways to write a negative number where it is different, e.g. one's complement.