Question

In: Computer Science

(a) Convert the decimal numbers, 70 and -26 to binary in the signed 2’s complement system....

(a) Convert the decimal numbers, 70 and -26 to binary in the signed 2’s complement system. Make sure there are enough digits in the results to be able to perform arithmetic operations with these two numbers.

(b) Perform in the signed 2’s complement system, (+70) + (-26)

(c) Perform in the signed 2’s complement system, (-70) - (-26)

(d) Perform in the signed 2’s complement system, (+70) + (+26)

Solutions

Expert Solution

a)
70
Since this is a positive number. we can directly convert this into binary
Divide 70 successively by 2 until the quotient is 0
   > 70/2 = 35, remainder is 0
   > 35/2 = 17, remainder is 1
   > 17/2 = 8, remainder is 1
   > 8/2 = 4, remainder is 0
   > 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 1000110
So, 70 of decimal is 1000110 in binary
so, 70 in 2's complement binary is 01000110

-26
This is negative. so, follow these steps to convert this into a 2's complement binary
Step 1:
Divide 26 successively by 2 until the quotient is 0
   > 26/2 = 13, remainder is 0
   > 13/2 = 6, remainder is 1
   > 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 11010
So, 26 of decimal is 11010 in binary
So, 26 in normal binary is 00011010
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   00011010 is flipped to 11100101
Step 3:. Add 1 to above result
11100101 + 1 = 11100110
so, -26 in 2's complement binary is 11100110

b)
Adding 01000110 and 11100110 in binary
    01000110
    11100110
-------------
 (1)00101100
-------------
Sum produces a carry of 1. We can ignore that carry.
So, sum of these numbers in binary is 00101100

Verification:
---------------
sum = 00101100
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
Converting 101100 to decimal
101100
=> 1x2^5+0x2^4+1x2^3+1x2^2+0x2^1+0x2^0
=> 1x32+0x16+1x8+1x4+0x2+0x1
=> 32+0+8+4+0+0
=> 44
Answer: 44
This is correct since we can verify that 70+-26 = 44
So, there was no overflow.

c)
Number: -70
Let's convert this to two's complement binary
-70
This is negative. so, follow these steps to convert this into a 2's complement binary
Step 1:
Divide 70 successively by 2 until the quotient is 0
   > 70/2 = 35, remainder is 0
   > 35/2 = 17, remainder is 1
   > 17/2 = 8, remainder is 1
   > 8/2 = 4, remainder is 0
   > 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 1000110
So, 70 of decimal is 1000110 in binary
So, 70 in normal binary is 01000110
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   01000110 is flipped to 10111001
Step 3:. Add 1 to above result
10111001 + 1 = 10111010
so, -70 in 2's complement binary is 10111010

Number: 26
Let's convert this to two's complement binary
26
Since this is a positive number. we can directly convert this into binary
Divide 26 successively by 2 until the quotient is 0
   > 26/2 = 13, remainder is 0
   > 13/2 = 6, remainder is 1
   > 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 11010
So, 26 of decimal is 11010 in binary
so, 26 in 2's complement binary is 00011010

Adding 10111010 and 00011010 in binary
    10111010
    00011010
-------------
 (0)11010100
-------------
Sum does not produces a carry
So, sum of these numbers in binary is 11010100

Verification:
---------------
sum = 11010100
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.
   11010100 is flipped to 00101011
II. Add 1 to above result
00101011 + 1 = 00101100
III. Now convert this result to decimal value
Converting 101100 to decimal
101100
=> 1x2^5+0x2^4+1x2^3+1x2^2+0x2^1+0x2^0
=> 1x32+0x16+1x8+1x4+0x2+0x1
=> 32+0+8+4+0+0
=> 44
Answer: -44
This is correct since we can verify that -70+26 = -44
So, there was no overflow.

d)
Number: 70
Let's convert this to two's complement binary
70
Since this is a positive number. we can directly convert this into binary
Divide 70 successively by 2 until the quotient is 0
   > 70/2 = 35, remainder is 0
   > 35/2 = 17, remainder is 1
   > 17/2 = 8, remainder is 1
   > 8/2 = 4, remainder is 0
   > 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 1000110
So, 70 of decimal is 1000110 in binary
so, 70 in 2's complement binary is 01000110

Number: 26
Let's convert this to two's complement binary
26
Since this is a positive number. we can directly convert this into binary
Divide 26 successively by 2 until the quotient is 0
   > 26/2 = 13, remainder is 0
   > 13/2 = 6, remainder is 1
   > 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 11010
So, 26 of decimal is 11010 in binary
so, 26 in 2's complement binary is 00011010

Adding 01000110 and 00011010 in binary
    01000110
    00011010
-------------
 (0)01100000
-------------
Sum does not produces a carry
So, sum of these numbers in binary is 01100000

Verification:
---------------
sum = 01100000
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
Converting 1100000 to decimal
1100000
=> 1x2^6+1x2^5+0x2^4+0x2^3+0x2^2+0x2^1+0x2^0
=> 1x64+1x32+0x16+0x8+0x4+0x2+0x1
=> 64+32+0+0+0+0+0
=> 96
Answer: 96
This is correct since we can verify that 70+26 = 96
So, there was no overflow.

Related Solutions

Convert decimal +47 and +31 to binary, using the signed-2’s-complement representation and enough digits to accommodate...
Convert decimal +47 and +31 to binary, using the signed-2’s-complement representation and enough digits to accommodate the numbers. Then perform the binary equivalent of (+31)+(-47), (-31)+(+47), and (-31)+(-47). Convert the answers back to decimal and verify that they are correct.
(16%) Convert decimal +47 and +38 to binary, using the signed-2’s-complement representation and enough digits to...
(16%) Convert decimal +47 and +38 to binary, using the signed-2’s-complement representation and enough digits to accommodate the numbers, Then, perform the binary equivalent of (+47)+(-38) and (-47)+(-38) using addition. Convert the answers back to decimal and verify that they are correct.
Please convert decimal value -32760 into 2's complement binary value
Please convert decimal value -32760 into 2's complement binary value
a)The decimal equivalent of the signed 2’s complement 8-bit binary number 11010101B is ______________. b)The decimal...
a)The decimal equivalent of the signed 2’s complement 8-bit binary number 11010101B is ______________. b)The decimal equivalent of the unsigned 8-bit hex number 0B4H is ______________. c)The value of the expression ‘H’ – ‘B’ is less than / equal to / greater than that of the expression ‘L’ – ‘C’. d)If the .data segment contains declarations                         A    BYTE      2 DUP (‘a’), ‘+’ B    BYTE      3 DUP (‘b’), 0 C    BYTE      4 DUP (‘c’), ‘–’ D    BYTE     ...
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
Convert signed integer 0xACE9 to binary and decimal. Convert unsigned integer0xACE9 to binary and decimal.
Convert signed integer 0xACE9 to binary and decimal. Convert unsigned integer0xACE9 to binary and decimal.
Convert the following hexadecimal representations of 16-bit 2’s complement binary numbers to decimal. a.FCAD b.DEAD c.1111...
Convert the following hexadecimal representations of 16-bit 2’s complement binary numbers to decimal. a.FCAD b.DEAD c.1111 d.8000 e.FACE
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
1) Convert negative fractional decimal number to 8-bit binary number: – 16.625 (use 2's complement binary...
1) Convert negative fractional decimal number to 8-bit binary number: – 16.625 (use 2's complement binary format) Hint: –17 + 0.375 Given the hint above, the fractional number will be divided into two parts, - Whole number, - Fractional part, must be positive (2) Proof to check that your calculation above is correct
The standard method of representing negative numbers in the binary system is with 2's complement notation....
The standard method of representing negative numbers in the binary system is with 2's complement notation. What are the advantages and disadvantages of using this method to represent negative numbers?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT