What is the advantage of 2's complement over 1's complement in negative number representation in binary number system? How does it affect the range of values stored in a certain bit representation of number in binary system?
Explanation: The advantage of 2's complement is that only one arithmetic operation is required for 2's complement's operation and that is only addition. Just by adding a 1 bit to 1's complement, we get 2's complement.
1's complement arithmetic operations are not easier than 2's complement because of addition of end-around-carry-bit. 2's complement arithmetic operations are much easier than 1's complement because of there is no addition of end-around-carry-bit.
The main difference between 1′ s complement and 2′ s complement is that 1′ s complement has two representations of 0 (zero) — 00000000, which is positive zero (+0), and 11111111, which is negative zero (-0); whereas in 2′ s complement, there is only one representation for zero — 00000000 (0) because if we add 1 to ...
Disadvantages. 1's complement notation is not very simple to understand because it is very much different from the conventional way of representing signed numbers. The other disadvantage is that there are two notations for 0 (0000 and 1111), which is very inconvenient when the computer wants to test for a 0 result.
The primary advantage of two's complement over one's complement is that two's complement only has one value for zero. One's complement has a "positive" zero and a "negative" zero.
Next, to add numbers using one's complement you have to first do binary addition, then add in an end-around carry value.
Two's complement has only one value for zero, and doesn't require carry values.
You also asked how the range of values stored are affected. Consider an eight-bit integer value, the following are your minimum and maximum values:
Notation Min Max ========== ==== ==== Unsigned: 0 255 One's Comp: -127 +127 Two's Comp: -128 +127
References:
The major advantages are:
In 1's there is a -0
(11111111
) and a +0
(00000000
), i.e two value for the same 0
. On the other hand, in 2's complement, there is only one value for 0
(00000000
). This is because
+0 --> 00000000
and
-0 --> 00000000 --> 11111111 + 1 --> 00000000
While doing arithmetic operations like addition or subtraction using 1's, we have to add an extra carry bit, i.e 1
to the result to get the correct answer, e.g.:
+1(00000001) + -1(11111110) ----------------- = (11111111)
but the correct answer is 0
. In order to get 0
we have to add a carry bit 1
to the result (11111111 + 1 = 00000000
).
In 2's complement, the result doesn't have to be modified:
+1(00000001) + -1(11111111) ----------------- = 1 00000000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With