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

(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.
convert +38 and +17 to binary using the signed 2s complement representation and enough digits to...
convert +38 and +17 to binary using the signed 2s complement representation and enough digits to accomaodate the numbers. Then perform the binary equivalent of (-38) and +17
(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) {...
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 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.
1.convert the following numbers from decimal to binary assuming seven-bit twe's complement binary representation: a)49 b)...
1.convert the following numbers from decimal to binary assuming seven-bit twe's complement binary representation: a)49 b) -27 c)0 d) -64 e) -1 f) -2 g) what is the range for this computer as written in binary and in decimal? 2.convert the following numbers from decimal to binary assuming nine-bit twe's complement binary representation: a)51 b) -29 c) -2 d)0 e) -256 f) -1 g ) what is the range for this computer as written in binary and in decimal?
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
Represent the decimal number -6 in binary using 4-bits: 3a) signed magnitude ____________________________ 3b) 1’s complement...
Represent the decimal number -6 in binary using 4-bits: 3a) signed magnitude ____________________________ 3b) 1’s complement _____________________________ 3c) 2’s complement _____________________________
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT