Example: 1101 and -1001
Case 2: Adding of the positive value with a negative value when the negative number has a higher magnitude.
Initially, add a positive value with the 2's complement value of the negative number. Here, no end-around carry is found. So, we take the 2'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 2's complement of both the negative numbers, and then we will add both these complement numbers. In this case, we will always get the end-around carry, which will be added to the LSB, and forgetting the final result, we will take the2's complement of the result.
Note: The resultant is a negative value.
Example: -1101 and -1110 in five-bit register
Example 1: 10101 - 00111
We take 2's complement of subtrahend 00111, which is 11001. Now, sum them. So,
10101 + 11001 = 1 01110.
In the above result, we get the carry bit 1. So we discard this carry bit and remaining is the final result and a positive number.
Example 2: 10101 - 10111
We take 2's complement of subtrahend 10111, which comes out 01001. Now, we add both of the numbers. So,
10101 + 01001 = 11110.
In the above result, we didn't get the carry bit. So calculate the 2's complement of the result, i.e., 00010. It is the negative number and the final answer.
6 videos|76 docs|52 tests
|
|
Explore Courses for Electronics and Communication Engineering (ECE) exam
|