Question

In: Computer Science

add the following numbers using 16-bit 2's complement. show all the steps and calculations. Please also...

add the following numbers using 16-bit 2's complement.
show all the steps and calculations.
Please also show steps to verify that the answer is correct.

-7493 and -6372

Solutions

Expert Solution

Number: -7493
Let's convert this to two's complement binary
This is negative. so, follow these steps to convert this into a 2's complement binary
Step 1:
Divide 7493 successively by 2 until the quotient is 0
   > 7493/2 = 3746, remainder is 1
   > 3746/2 = 1873, remainder is 0
   > 1873/2 = 936, remainder is 1
   > 936/2 = 468, remainder is 0
   > 468/2 = 234, remainder is 0
   > 234/2 = 117, remainder is 0
   > 117/2 = 58, remainder is 1
   > 58/2 = 29, remainder is 0
   > 29/2 = 14, remainder is 1
   > 14/2 = 7, remainder is 0
   > 7/2 = 3, remainder is 1
   > 3/2 = 1, remainder is 1
   > 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 1110101000101
So, 7493 of decimal is 1110101000101 in binary
Adding 3 zeros on left hand side of this number to make this of length 16
So, 7493 in normal binary is 0001110101000101
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   0001110101000101 is flipped to 1110001010111010
Step 3:. Add 1 to above result
1110001010111010 + 1 = 1110001010111011
so, -7493 in 2's complement binary is 1110001010111011

Number: -6372
Let's convert this to two's complement binary
This is negative. so, follow these steps to convert this into a 2's complement binary
Step 1:
Divide 6372 successively by 2 until the quotient is 0
   > 6372/2 = 3186, remainder is 0
   > 3186/2 = 1593, remainder is 0
   > 1593/2 = 796, remainder is 1
   > 796/2 = 398, remainder is 0
   > 398/2 = 199, remainder is 0
   > 199/2 = 99, remainder is 1
   > 99/2 = 49, remainder is 1
   > 49/2 = 24, remainder is 1
   > 24/2 = 12, remainder is 0
   > 12/2 = 6, remainder is 0
   > 6/2 = 3, remainder is 0
   > 3/2 = 1, remainder is 1
   > 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 1100011100100
So, 6372 of decimal is 1100011100100 in binary
Adding 3 zeros on left hand side of this number to make this of length 16
So, 6372 in normal binary is 0001100011100100
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   0001100011100100 is flipped to 1110011100011011
Step 3:. Add 1 to above result
1110011100011011 + 1 = 1110011100011100
so, -6372 in 2's complement binary is 1110011100011100

Adding 1110001010111011 and 1110011100011100 in binary
1110001010111011
1110011100011100
---------------------
(1)1100100111010111
---------------------
Sum produces a carry of 1. We can ignore that carry.
So, sum of these numbers in binary is 1100100111010111

Verification:
---------------
sum = 1100100111010111
since left most bit is 1, this number is negative number.
so, follow these steps below to convert this into a decimal value.
I. first flip all the bits. Flip all 0's to 1 and all 1's to 0.
   1100100111010111 is flipped to 0011011000101000
II. Add 1 to above result
0011011000101000 + 1 = 0011011000101001
III. Now convert this result to decimal value
=> 11011000101001
=> 1x2^13+1x2^12+0x2^11+1x2^10+1x2^9+0x2^8+0x2^7+0x2^6+1x2^5+0x2^4+1x2^3+0x2^2+0x2^1+1x2^0
=> 1x8192+1x4096+0x2048+1x1024+1x512+0x256+0x128+0x64+1x32+0x16+1x8+0x4+0x2+1x1
=> 8192+4096+0+1024+512+0+0+0+32+0+8+0+0+1
=> 13865
Answer: -13865
This is correct since we can verify that -7493+-6372 = -13865
So, there was no overflow.


Related Solutions

Please show all work: Determine the 2’s complement equivalent of the following numbers in 8-bit format...
Please show all work: Determine the 2’s complement equivalent of the following numbers in 8-bit format (N.B: You must show your work for full credit)! -12 = -9 =
Convert the following decimal numbers to 16-bit 2’s complement binary. Display your result in hexadecimal. a.3030...
Convert the following decimal numbers to 16-bit 2’s complement binary. Display your result in hexadecimal. a.3030 b.404 c.5050 d.-5050 e.-20000 Show work with steps
7 – For the following operations: • write the operands as 4-bit 2's complement binary numbers,...
7 – For the following operations: • write the operands as 4-bit 2's complement binary numbers, • perform the operation shown, • show all work in binary operating on 4-bit numbers, and • identify overflow if necessary. a) 4 + 2 b) 4 – 2 c) 2 – 4 d) 4 + 4
Add or subtract the following 2’s complement form signed numbers, then convert the entire problem to...
Add or subtract the following 2’s complement form signed numbers, then convert the entire problem to decimal and confirm: 110110 + 111000 001100 – 011100
Assuming integers are represented as 16-bit words and negative numbers are represented using the 2's complementary...
Assuming integers are represented as 16-bit words and negative numbers are represented using the 2's complementary method, convert the following hexadecimal numbers to decimal numbers a. 0xCAFE, b. 0x4DAD, c. 0xFACE
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -122 to 8-bit sign magnitude, 1's complement and 2's complement
Convert -122 to 8-bit sign magnitude, 1's complement and 2's complement
Convert -122 to 8-bit sign magnitude, 1's complement and 2's complement
Convert -122 to 8-bit sign magnitude, 1's complement and 2's complement
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT