2's complementJust like 1's complement, 2's complement is also used to represent the signed binary numbers. For finding 2's complement of the binary number, we will first find the 1's complement of the binary number and then add 1 to the least significant bit of it. For example, if we want to calculate the 2's complement of the number 1011001, then firstly, we find the 1's complement of the number that is 0100110 and add 1 to the LSB. So, by adding 1 to the LSB, the number will be (0100110)+1=0100111. We can also create the logic circuit using OR, AND, and NOT gates. The logic circuit for finding 2's complement of the 5bit binary number is as follows: Example 1: 110100 For finding 2's complement of the given number, change all 0's to 1 and all 1's to 0. So the 1's complement of the number 110100 is 001011. Now add 1 to the LSB of this number, i.e., (001011)+1=001100. Example 2: 100110 For finding 1's complement of the given number, change all 0's to 1 and all 1's to 0. So, the 1's complement of the number 100110 is 011001. Now add one the LSB of this number, i.e., (011001)+1=011010. 2's Complement Table
Use of 2's complement2's complement is used for representing signed numbers and performing arithmetic operations such as subtraction, addition, etc. The positive number is simply represented as a magnitude form. So there is nothing to do for representing positive numbers. But if we represent the negative number, then we have to choose either 1's complement or 2's complement technique. The 1's complement is an ambiguous technique, and 2's complement is an unambiguous technique. Let's see an example to understand how we can calculate the 2's complement in signed binary number representation. Example 1: +6 and 6 The number +6 is represented as same as the binary number. For representing both numbers, take the 5bit register. So the +6 is represented in the 5bit register as 0 0110. The 6 is represented in the 5bit register in the following way:
Example 2: +120 and 120 The number +120 is represented as same as the binary number. For representing both numbers, take the 8bit register. So the +120 is represented in the 8bit register as 0 1111000. The 120 is represented in the 8bit register in the following way:
Next TopicSigned
