Case 1: Addition of the positive number with a negative number when the positive number has a greater magnitude.
Initially, calculate the 1's complement of the given negative number. Sum up with the given positive number. If we get the end-around carry 1, it gets added to the LSB.
Example: 1101 and -1001
Case 2: Adding a positive value with a negative value in case the negative number has a higher magnitude.
Initially, calculate the 1's complement of the negative value. Sum it with a positive number. In this case, we did not get the end-around carry. So, take the 1's complement of the result to get the final result.
Note: The resultant is a negative value.
Example: 1101 and -1110
Case 3: Addition of two negative numbers
In this case, first find the 1's complement of both the negative numbers, and then we add both these complement numbers. In this case, we always get the end-around carry, which get added to the LSB, and for getting the final result, we take the 1's complement of the result.
Note: The resultant is a negative value.
Example: -1101 and -1110 in five-bit register
Note: The subtrahend value always get subtracted from minuend.
Example 1: 10101 - 00111
We take 1's complement of subtrahend 00111, which comes out 11000. Now, sum them. So, 10101+11000 =1 01101.
In the above result, we get the carry bit 1, so add this to the LSB of a given result, i.e., 01101 + 1 = 01110, which is the answer.
Example 2: 10101 - 10111
We take 1's complement of subtrahend 10111, which comes out 01000. Now, add both of the numbers. So, 10101 + 01000 =11101.
In the above result, we didn't get the carry bit. So calculate the 1's complement of the result, i.e., 00010, which is the negative number and the final answer.
6 videos|76 docs|52 tests
|
|
Explore Courses for Electronics and Communication Engineering (ECE) exam
|