1’s Vs. 2’s Complement Representation: Know the Difference Between 1’s Complement Representation and 2’s Complement Representation Technique
We generally deploy Complements in digital computers for the manipulation of logic and for simplifying the subtraction operation. In the case of a base-2 (Binary Number) system, we can find two major types of these complements: the 1’s and the 2’s complement. In this article, we will discuss the difference between 1’s complement representation and 2’s complement representation technique. Let us first understand more about each of these individually.
What is 1’s Complement in a Binary Number?
In this case, a simple algorithm converts a binary number into the 1’s complement. If you want to generate 1’s complement out of a binary number, you can simply invert the number that you have.
What is 2’s Complement in a Binary Number?
In this case, too, we use a very simple algorithm for converting a binary number into a complement of 2’s. If you want to get a 2’s complement for any given binary number, you need to invert the number first. Then you can add 1 to the LSB (least significant bit) of the obtained result.
Difference Between 1’s Complement Representation and 2’s Complement Representation Technique
Parameters | 1’s Complement Representation | 2’s Complement Representation |
Process of Generation | To generate a 1’s complement for any given binary number, you only need to invert that number. | To generate a 2’s complement for any given binary number, you need to invert it. Then you need to add 1 to the LSB (Least Significant Bit) of the generated result. |
Example | For a binary number like 110010, the 1’s complement would be 001101. | For a binary number like 110010, the 2’s complement would be 001110. |
Logic Gates Used | It is a very simple type of implementation that makes use of the NOT gate for every bit of input. | It makes use of the BOT gate for every bit of input, along with a full adder. |
Number Representation | You can use the 1’s in case of a signed binary representation. Still, you cannot use it as an ambiguous representation in the case of the number 0. | You can use the 2’s in case of a signed binary representation. It is also the most suitable in the form of an unambiguous representation of all the available numbers. |
K-bits Register | In the case of a k-bits register, it can store the lowest negative number as -(2(k-1)-1) and the largest positive number as (2(k-1)-1). | In the case of a k-bits register, it can store the lowest negative number as -(2(k-1)) and the largest positive number as (2(k-1)-1). |
Representation of 0 | The number 0 has two major representations- one is +0 (for instance, 0 0000 in a five-bit register), and the second one is -0 (for instance, 1 1111 in a five-bit register). | The number -0 has a single representation for both +0 and -0 (for instance, 0 0000 in a five-bit register). Here, we always consider the zero to be positive. |
Sign Extension | We need to use the sign extension for the conversion of any signed integer from a given sign to another one. | In this case, too, we need to use the sign extension. It converts any signed integer from a given sign to another one. |
End-Around-Carry-Bit | In the case of a 1’s complement arithmetic operation, there occurs an addition of the end-around-carry-bit. We add it to the result’s LSB. | In the case of a 2’s complement arithmetic operation, no addition of end-around-carry-bit occurs. It ignores this addition. |
Ease of Operation | The complement arithmetic operations of 1’s type are not easier than the 2’s type because they always need to add end-around-carry-bit. | The complement arithmetic operations of the 2’s type are much easier to operate than the 1’s type because they lack the addition of end-around-carry-bit. |
Keep learning and stay tuned to get the latest updates on GATE Exam along with GATE Eligibility Criteria, GATE 2023, GATE Admit Card, GATE Syllabus, GATE Previous Year Question Paper, and more.
Comments