Question

In: Computer Science

Perform the following calculation in a 6-bit two’s complement system. Show your work. Indicate at the...

  1. Perform the following calculation in a 6-bit two’s complement system. Show your work. Indicate at the end if there will be overflow/underflow or not and why.
    1810 – 1010

Solutions

Expert Solution

Number: 18
Let's convert this to two's complement binary
18
Since this is a positive number. we can directly convert this into binary
Divide 18 successively by 2 until the quotient is 0
   > 18/2 = 9, remainder is 0
   > 9/2 = 4, remainder is 1
   > 4/2 = 2, remainder is 0
   > 2/2 = 1, remainder is 0
   > 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 10010
So, 18 of decimal is 10010 in binary
so, 18 in 2's complement binary is 010010

Number: -10
Let's convert this to two's complement binary
-10
This is negative. so, follow these steps to convert this into a 2's complement binary
Step 1:
Divide 10 successively by 2 until the quotient is 0
   > 10/2 = 5, remainder is 0
   > 5/2 = 2, remainder is 1
   > 2/2 = 1, remainder is 0
   > 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 1010
So, 10 of decimal is 1010 in binary
So, 10 in normal binary is 001010
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   001010 is flipped to 110101
Step 3:. Add 1 to above result
110101 + 1 = 110110
so, -10 in 2's complement binary is 110110

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

Verification:
---------------
sum = 001000
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
Converting 1000 to decimal
1000
=> 1x2^3+0x2^2+0x2^1+0x2^0
=> 1x8+0x4+0x2+0x1
=> 8+0+0+0
=> 8
Answer: 8
This is correct since we can verify that 18+-10 = 8
So, there was no overflow.



Related Solutions

1. What is the two’s complement of: 00110101 2. Carry out the following calculation using 8-bit...
1. What is the two’s complement of: 00110101 2. Carry out the following calculation using 8-bit signed arithmetic (convert to 8-bit binary sequences) and use two’s complement for the negative number, give the result as both an 8-bit binary sequence and in base 10: 127 – 74. 3. What does shifting a binary sequence to left by 3 places correspond to (from the arithmetic standpoint)
(6 marks- 3 marks each) The following hexadecimal values are shorthand for 16-bit two’s complement binary...
(6 marks- 3 marks each) The following hexadecimal values are shorthand for 16-bit two’s complement binary numbers. Working purely in hex, negate each and then state whether the result is positive or negative. (a) 5E91 (b) D00F 2.
Convert the base-10 number to Two’s Complement. Show your work. (a) −12 (b) −32 (c) −57...
Convert the base-10 number to Two’s Complement. Show your work. (a) −12 (b) −32 (c) −57 (d) −112 (e) −24 (f) −85
Assume that we are executing the following code on a 32-bit machine using two’s complement arithmetic...
Assume that we are executing the following code on a 32-bit machine using two’s complement arithmetic for signed integers. Which of the following will be printed when the following code is executed (circle those printed, and show work; e.g., how the values are stored): #include <stdio.h> int main() { char x = 0xF;                // x = ________ char y = -1;                 // y = ________ unsigned char z = 0xFF;      // z = 11111111        if (x<z)     printf("performed unsigned compare,...
What is the 8-bit sum of the following 2’s complement numbers: 11101100+00001101? Show your work.
What is the 8-bit sum of the following 2’s complement numbers: 11101100+00001101? Show your work.
Find the decimal equivalents for the following 8-bit two’s complement numbers. a. 0010 0100 Decimal Equivalent...
Find the decimal equivalents for the following 8-bit two’s complement numbers. a. 0010 0100 Decimal Equivalent ___________ b. 1010 1001 Decimal Equivalent ___________ c. 1100 0011 Decimal Equivalent ___________ d. 0101 0101 Decimal Equivalent ___________
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 =
What decimal number is represented by the binary 2’s complement 8-bit number 11100111? Show your work
What decimal number is represented by the binary 2’s complement 8-bit number 11100111? Show your work
Binary How is 00001001 (base 2) represented in 8-bit two’s complement notation? Convert 0.3828125 to binary...
Binary How is 00001001 (base 2) represented in 8-bit two’s complement notation? Convert 0.3828125 to binary with 4 bits to the right of the binary point. How is 00110100 (base 2) represented in 8-bit one's complement.  
6) What is the 6-bit 1's complement representation of -1710? Write your answer in the format...
6) What is the 6-bit 1's complement representation of -1710? Write your answer in the format 0bXXXX... Where X's are binary digits. Include leading 0's (zeroes). 7)  What is the 6-bit sign-magnitude representation of -1710? Write your answer in the format 0bXXXX... Where X's are binary digits. Include leading 0's (zeroes). 9)  What is the 8-bit 1's complement representation of 1710? Write your answer in the format 0xHHHH... Where H's are hexidecimal digits. Include leading 0's (zeroes). Write hexidecimal digits, A-F, in...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT