Introduction to 2s Complement Addition
Do you know something about the term 2s complement addition? If not, do not worry, as this article covers everything about addition using 2s complement. 2s complement examples are also given for understanding to better understand the given topic. Some practice problems, based on binary addition using 2s complement, along with the 2s complement of negative numbers, are assigned for getting a hold of the concepts. So, let's get started with the learning process.
How to Write Numbers in Binary Format?
To convert the number to binary format, we must divide it by 2 until the further division is impossible and then write the remainder in the reverse order to obtain the corresponding binary format of the number. For example, let's convert 122 to binary form. We start by dividing the number, 122 by 2, as shown in the table, and noting the remainder in reverse order, i.e. 111010.
Thus the binary representation of 122 is 111010.
How to write Numbers in 2s Complement?
To convert the binary format to a 2s complement, we must replace the 0s with 1s and 1s with 0s, then add 1 to the inversion to obtain the required conversion. For example, write 2s complement of 9, whose binary representation is given by 1001.
This is done by replacing the 0s with 1s and vice versa, i.e. 0110. Now adding 1 to the inversion to obtain 2s complement, i.e. 0111.
Thus the 2s complement of 9 is 0111.
What is Addition Using 2s Complement?
Addition using 2s complement is done by converting the given numbers to binary form and then to 2s complement. After obtaining the 2s complement of the numbers, adding them will represent their 2s complement addition. It is a way of adding two numbers by making use of the 2s complement.
Binary addition and subtraction
This binary subtraction can be understood by 2’s complement method. We can’t subtract directly like addition.
Binary Addition Using 2s Complement
Here are some steps to carry out the binary addition using 2s complement:
Write the given numbers in binary form, if they are present in decimal form
Then write their corresponding 2s complement using the conversion of binary form to 2s complement
Now, carry out the addition of the obtained 2s complement, write the sum as 1 when adding 0 and 1 and write the sum as 0 when adding two 0s
When adding two 1s, you must write the sum as 0 and transfer the carry to the next term
For Example: Add 1010 and 0101 using 2s complement addition
Write the 2s complement of the numbers, i.e. 0110 and 1011 respectively. Now add their respective 2s complement, which would give the result 10001. Now, discard the carry and take two’s complement (1110 + 1 = 1111).
Sign Rules for 2s Complement Addition
Addition Using the 2s Complement of Positive Numbers
If both the given numbers in 2s complement addition are positive; then their result will always be a positive quantity.
If both numbers are positive, their 2’complement representation will be the same as its true (uncomplemented) form.
Addition Using the 2s Complement of Positive and Negative Numbers
If one number is positive and the other is negative in 2s complement addition, then the overall sign of their difference will depend on the sign of the bigger quantity, i.e. if a positive number has a greater magnitude, then the overall sign will be positive and if a negative number has a greater magnitude than the overall sign will be negative.
2s Complement of Negative Numbers
If both the given numbers in 2s complement addition are negative, then the corresponding result of their addition will be negative.
2s Complement Solved Examples
Q 1. Find the 2s complement of given numbers, converted in binary form: 1011 and -0101.
Ans: For finding the 2s complement of given numbers, we are required to follow some steps:
Convert the given binary number to 2s complement by replacing 0s with 1s and 1s with 0s; finally adding 1 to the inversion, i.e. 2s complement of 1011 is 1011, and -0101 is 1011.
Now, we add both the complement numbers, 1011 and 1011, i.e.
1011 + 1011 = 10110
Here, it can be noted that the carry can be discarded.
Thus, the 2s complement of the given numbers is 0110.
Q 2. Add 8 + 5.
Ans: Steps to perform addition are given as
Write the binary form of the numbers 8 and 5, i.e. 1000 and 0101, respectively
Add both the numbers, i.e. 1000 and 0101, which equals 1101.
Thus, the result of addition is given by 1101.
Practice Problems
Q 1. Using addition with 2s complement, calculate the sum of 1101 and -1110.
Ans: -0001
Q 2. Add 0011 and -0101.
Ans: -0010
Q 3. Find the addition with 2s complement of a negative number, -8 and -5.
Ans: -1101
Summary
To wrap up here with the topic of addition using 2s complement. Reading this article, we got a clear understanding of our topic. In addition, an important operation used in mathematics can be easily found using the 2s complement. This writing has discussed the steps required to perform the binary addition using a 2s complement. Some 2s complement examples are also given to clarify the concepts deeply. I hope you find it useful to read the article. Feel free to put your doubts in the comments.
FAQs on 2s Complement Addition
1. Which is a more convenient way of solving the problem involving negative numbers, 1s complement or 2s complement?
When dealing with problems involving negative numbers, a 2s complement is a more convenient way of solving as compared with a 1s complement, as it gives a more accurate result than a 1s complement. This is because 2s complement allows you to get the negative of a number by reversing each of its bits and then adding one.
2. Can one solve subtraction problems using 2s complement?
Yes, one can solve subtraction problems using the technique of 2s complement.
3. What are the advantages of using a 2s complement addition?
Some advantages of using 2s complement are given below:
It can be simply used in place of natural addition and subtraction.
It possesses a single value of 0, i.e. only a positive value.
There is no requirement to modify the result obtained.