truncation in two's complment

5.3k Views Asked by At

My textbook gives an example of truncating a signed number in two's complement from 4 bits to 3 bits. It truncates -4 to 4. I am little confused by this, because the binary representation of -4 is 1100. 1100 being truncated to 3 bits at the most significant side yields 100, which is -4 in decimal.

I am not sure, if I am missing something, but according to the book it should be 4. Am I missing something?

2

There are 2 best solutions below

0
On BEST ANSWER

You are correct, either they truncated from a signed number to an unsigned number or they forgot a minus sign.

0
On

The four bit two's complement representation of $-4$ is $1100$, which you get by bit complementing $0100$ to get $1011$ then adding one to get $1100$. You are correct that in three bit two's complement notation $100$ is $-4$ decimal. You will get proper truncation any time the high order bits are the same down to the first bit you keep, as is the case here.