To Perform the airthmatic Operat
(+42)+(-13) and (-42)-(-13)
by using Signed-2s Complement
representation & Show that
Whether overflow occured on
not.
Answers
Answer:
Step-by-step solution:
Step 1 of 5
Consider the following arithmetic operations:
In the above arithmetic operations 42 is the positive number and 13 is the negative number.
So, first the positive number that is 42 is converted into binary numbers.
When 42 are converted into binary number then the result is. When number is negative then first that number is converted into binary number and after that two compliment of the numbers need to be found by taking the compliment of the number and then adding with 1.
So, when +13 are converted to binary number then the result is 00001101. But 13 are negative then user needs to take 2’s compliment of the number so results after 2’s compliment are 11110011.
Decimal number and corresponding binary equivalent is as shown:
Hence, when arithmetic operations is converted into binary number using 2’s complements result is 00011101
In signed-2's complement representation, positive numbers are represented in binary form, and negative numbers are represented as the 2's complement of the corresponding positive number.
- (+42) + (-13)
- To perform this operation, we need to first convert the numbers to binary form using signed-2's complement representation.
- Positive 42 in binary form: 00101010
- Negative 13 in binary form: 11011101
- To add these two numbers, we simply add them as binary numbers with the carry bit, and if an overflow occurs, it will indicate that the result is not representable in the given number of bits.
- 00101010
- +11011101
- 100100111 (overflow)
- In this case, an overflow has occurred, and the result cannot be represented in 8 bits using signed-2's complement representation.
- (-42) - (-13)
- Positive 42 in binary form: 00101010
- Negative 42 in binary form: 11010110
- Positive 13 in binary form: 00001101
- Negative 13 in binary form: 11110011
- To subtract these two numbers, we perform 2's complement of the second number and then add it to the first number as binary numbers.
- 11010110
- +11110011
- 10011101
- In this case, no overflow has occurred, and the result can be represented in 8 bits using signed-2's complement representation. The result is -29 in decimal form.
#SPJ3