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,...
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 ___________
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.  
Evaluate the following expressions, where two’s complement numbers, A is 11111110 and B is 00000010 and...
Evaluate the following expressions, where two’s complement numbers, A is 11111110 and B is 00000010 and indicate the results. a. A + B b. A – B c. B–A d. –B e. – (-A)
Solve each of the following problems by translating the values into two’s complement notation (using patterns...
Solve each of the following problems by translating the values into two’s complement notation (using patterns of 5 bits), converting any subtraction problem to an equivalent addition problem, and performing that addition. Check your work by converting your answer to base 10 notation. (Watch out for overflow.) a. 5 + 1 b. 12 – 5 c. 5 – 11 d. 12 + 5 e. 5 – 1
Show the decimal integer -143 in 10-bit sign magnitude, one's complement, two's complement and excess-511 respectively...
Show the decimal integer -143 in 10-bit sign magnitude, one's complement, two's complement and excess-511 respectively in the given order
Convert the following numbers to 32-bit, 2s compliment binary and hexadecimal formats. Show your work in...
Convert the following numbers to 32-bit, 2s compliment binary and hexadecimal formats. Show your work in recursive division form. 899726616 1656906428 -77102817 -251026154
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT