Note: The 1`s complement and the 2`s complement of a binary number are important because they permit the representation of negative numbers.
∴ Finding the 1`s complement:-
The 1`s complement of a binary number is found by changing all 1s to 0s and all 0s to 1s.
→ How to find 1`s complement of binary number.
∴ 1`s complement using NOT gate.
Q). Find the 1`s complement of (10110)2 solution:- 1`s complements = 01001 |
Finding the 2`s complement
The 2`s complement of a binary number is found by adding 1 to the LSB of the 1`s complement.
∴ 2`s complement = (1`s complement) + 1
→ How find 2`s complement of binary number?
∴ Alternative way to find direct 2`s complement
- Start at the right with the LSB and write the bits as they are up to and including the first 1.
- Yake the 1`s complement of the remaining bits
In the above solution, we should write the same binary digits from right to left until we found 1, after that change the remaining bits into 1`s complement as shown above.
→ Subtraction using 1`s complement
• Step 1:- Take 1`s complement of subtrahend
• Step 2:- Add 1`s complement of subtrahend with minuend
• Step 3:- If got a carry, add the carry to its LSB. Else take 1’s complement of the result and put negative sign
Subtracting using 2`s complement
Step 1. Take 2`s complement of subtrahend
Step 2. Add 2`s complement of subtrahend with minuend
Step 3. If there is no carry , the result is negative and take the 2`s complement of above result and place negative sign in the final result.