Negative One vs Seven: A 2's Complement Comparison

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 4K views
amaresh92
Messages
163
Reaction score
0
in 2's complement the negative of 1 is "111". but it also signifies 7 in decimal. how does this -ve 1 is differ from 7?
thanks
 
Engineering news on Phys.org
Do you not mean 1001 and 0111? (the most sig digit needs to be included or you can't represent numbers that way).
These two numbers represent one above and one below 1000, which is half way up the range from zero to fifteen. It is convenient to use 1000 (8) as a zero point then you can go above or below it - just like using half of your graph paper for positive numbers and half for the negative numbers. So we call 9, +1 and 7, -1 etc.

This system is better than using a number and a sign digit because that system produces plus and minus zero! and your number scale has a hiccup in it. Not very good for doing sums with. The two's complement system allows you to add and subtract binary numbers, positive and negative, whereas number and sign can produce the wrong answer.
You may have noticed that this system is lopsided - there's one more number (0000) at the bottom than at the top but it's a small price to pay if you want to do calculations.
 
amaresh92 said:
in 2's complement the negative of 1 is "111". but it also signifies 7 in decimal. how does this -ve 1 is differ from 7?
thanks
Assuming 3 bits, the only difference is in the interpretation.

[tex] \begin{array}{c|ccccc}<br /> \mbox{Bit Pattern} & \mbox{Unsigned} & \mbox{Signed Magnitude} &<br /> \mbox{1s Complement} & \mbox{2s Complement} & \mbox{Excess-3} \\<br /> 000 & 0 & +0 & +0 & \phantom{+}0 & -3 \\<br /> 001 & 1 & +1 & +1 & +1 & -2 \\<br /> 010 & 2 & +2 & +2 & +2 & -1 \\<br /> 011 & 3 & +3 & +3 & +3 & \phantom{+}0 \\<br /> 100 & 4 & -0 & -3 & -4 & +1 \\<br /> 101 & 5 & -1 & -2 & -3 & +2 \\<br /> 110 & 6 & -2 & -1 & -2 & +3 \\<br /> 111 & 7 & -3 & -0 & -1 & +4<br /> \end{array}[/tex]

Bottom line: There is no telling just from looking at the bit pattern what a bit pattern represents. You need to know the context.

Note also that signed magnitude and 1s complement suffer from having +0 and -0. That can create some nasty problems. Note that 2s complement does not have a +0/-0 problem but does have an asymmetry; there is one more negative number, -4 in this case, than there are positive numbers in 2s complement. The opposite occurs with excess-N.