Question

In: Computer Science

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.

Solutions

Expert Solution

(+31) + (-47) = -16

(-31) + (+47) = 16

(-31) + (-47) = -78

Explanation:

47 in binary = 1011112

31 in binary = 111112

Let the signed number system be of 8 bit then

47 = 0010 1111

31 = 0001 1111

-47 = 1101 0001 (in 2's compliment)

-31 = 1110 0001 (in 2's compliment)

Conversion to 2's compliment explanation:

first convert decimal number to binary here 47 = 0010 1111

since the number is negative convert it to 1's compliment just flip the bits 1 to 0 and 0 to 1

1's compliment: 1101 0000

add 1 to 1's compliment we get 2's compliment

1101 0000 + 1

1101 0001

2's compliment conversion is same for -31 as well

Coming to questions:

(+31) + (-47) = -16

+31 = 0001 1111

-47 = 1101 0001

(+31) + (-47) =

= .1111 0000

since the MSB is 1 hence the number is negative. converting it to 2' compliment we get 0001 0000

in decimal 0001 0000 = 16 Since MSB is 1 hence it is -16

(-31) + (+47) = 16

-31 = 1110 0001

+47 = 0010 1111

(-31) + (+47) =

= 0001 0000

since MSB is 0 the number is positive no need for 2's compliment: 0001 0000 in decimal is 16

(-31) + (-47) = -78

-31 = 1110 0001

-47 = 1101 0001

(-31) + (-47) =

= 1011 0010

Since MSB is 1 hence the number is negative convert it to 2's compliment we get 0100 1110

In decimal it is -78.


Related Solutions

(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)
i need to convert decimal to twos complement binary and then add the binary digits but...
i need to convert decimal to twos complement binary and then add the binary digits but I am unable to do it. I am only allowed to use string, can anyone help me out please. i need the code urgently. #include #include #include #include using namespace std; string reverse(string s) { string x = ""; for (long i = s.length() - 1; i >= 0; i--) { x += s[i]; } return x; } string twosComplementStringsAddition(string A, string B) {...
(6 pts) Convert the data representation given below • Convert 10110111 unsigned binary representation, to decimal...
(6 pts) Convert the data representation given below • Convert 10110111 unsigned binary representation, to decimal representation. • Convert 01100000101110000001010111111000 the binary representation to a hexadecimal representation. • Convert 0xBAAADA55 hexadecimal representation, to a binary representation. 2. (8 pts) Complete the following arithmetic operations in two’s complement representation. What are the values of the carry flag and the overflow flag? (Assume a six-bit system) • 31 + 11 • 13 – 15 • (-2) x (-16) • (-15) ÷ 5
Design a 9’s complement of a Binary Coded Decimal
Design a 9’s complement of a Binary Coded Decimal
Part 2: Signed values: Convert each as indicated. 8. Decimal to Hexadecimal (1 byte, one's complement)...
Part 2: Signed values: Convert each as indicated. 8. Decimal to Hexadecimal (1 byte, one's complement)      a. -18      b. -41
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
Write -127 as 8 bit signed binary number both using 2'complement and sign/magnitude notation.
Write -127 as 8 bit signed binary number both using 2'complement and sign/magnitude notation.
Complete the matrix below (use 4 bits) Signed Integer Signed Magnitude 1’s Complement 2’s Complement Excess-7...
Complete the matrix below (use 4 bits) Signed Integer Signed Magnitude 1’s Complement 2’s Complement Excess-7 5 -3
Complete the matrix below (use 4 bits) Signed Integer Signed Magnitude 1’s Complement 2’s Complement Excess-7...
Complete the matrix below (use 4 bits) Signed Integer Signed Magnitude 1’s Complement 2’s Complement Excess-7 5 -3
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.  
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT