My homework problem invloves adding negative and positivebinary numbers. How do
ID: 3614676 • Letter: M
Question
My homework problem invloves adding negative and positivebinary numbers. How do I determine how many bits to use torepresent a number and how do I solve this problem?Perform the arithmetic operations (+33)+(-21) and (-37)-(-26) inbinary using signed 2’s complement representation fornegative numbers. Thank you. My homework problem invloves adding negative and positivebinary numbers. How do I determine how many bits to use torepresent a number and how do I solve this problem?
Perform the arithmetic operations (+33)+(-21) and (-37)-(-26) inbinary using signed 2’s complement representation fornegative numbers. Thank you. Thank you.
Explanation / Answer
In general, we can use 8 bit representation to denote numbersfrom 0 to 255, since we can represent the two bits 0 and 1 in 256(2 power 8 ) ways in 8 bit form.
Following is the way to solve the given expressions:
To represent a negative number we use 2’s complement.
So +21 is 00010101 and -21 is 2’s complement of 00010101(+21)
2’s complement of 00010101 --- 1’s complement +1
11101010
00000001
________
11101011
Now we add +33 (00100001) and -27 (11101011)
00010001
11101011
________
00001100 = 12
37 – 00100101 and – 37 is 2’s complement of37
11011010
00000001
________
11011011
26 – 00011010 and -26 is 2’s complement of 26
11100101
00000001
________
11100110
To subtract two numbers, we add the 2’s complement ofsecond number to the first number and again 2’s complementthe result to obtain the subtraction value.
So we take the 2’s complement of -26 and add it to-37
2’s complement of -26 is
00011001
00000001
________
00011010
Now we add this number to -37
11011011
00011010
________
11110101
2’s complement of the obtained value 11110101 is theresult.
2’s complement is
00001010
00000001
________
00001011 = 11
(-37)-(-26) =11
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.