Binary operation problem

MrChips

Joined Oct 2, 2009
30,806
There are many ways to represent numbers in binary, whether positive or negative.

2's compliment is only one of many ways.
 

WBahn

Joined Mar 31, 2012
30,058
View attachment 84514


Now in 2's complement if I remove left most bit from answer, then will answer become (+3) and (-3) ?

OR

Any other method should I use ?

I am confused, please help me, Thanks.
That chart appears to be making the point that if you blindly do normal binary addition on signed integers that you get the correct answer if the values are represented using 2's compliment and possibly the wrong answer if you used signed-binary.

The reason for this is because 2's compliment maintains the cyclical ordering of the values represented. The more fundamental reason, but this is probably gibberish to you right now, is that 2's complement preserves the mapping between the n-bit binary bit patterns and the residue classes mod 2^n.

As for whether removing the leftmost bit from the answer will turn (+3) to (-3). Try it.

(+3) = 0011
remove the leftmost bit
(011) = ???

Is that -3?

If not, then you have your answer.

Now, when you say "any other method you should use", any other method to do what? Turn (+3) to (-3) in 2's complement? There are several ways. The classic way is to apply the defining relationship of 2's complement representation and invert all the bits and add one to the result.
 

Thread Starter

*.*.*AnUm*.*.*

Joined Apr 21, 2015
16
(+3) = 0011
remove the leftmost bit
(011) = ???

Is that -3?

no

got it. but I still have little confusion, please see this, how carry is discarding ???

see attachment for my question.
Thanks.
 

Attachments

WBahn

Joined Mar 31, 2012
30,058
The carry is discarded because there is not place to store it. You have a four-bit representation, thus you can't store four bits.

All of the binary representation schemes for signed numbers rely on the use of a fixed-width representation.
 
Top