Given , 2\'s complement of A= 10101011 (here sign bit = 1 => negative) A= -128*1
ID: 1935837 • Letter: G
Question
Given , 2's complement of A= 10101011 (here sign bit = 1 => negative) A= -128*1+64*0+32*1+16*0+8*1+4*0+2*1+1*1 = -128+32+8+2+1 = -128 + 43 = -85 A= -85 2's complement of B = 01101111 (here sign bit = 0=> positive) B = 128*0+64*1+32*1+16*0+8*1+4*1+2*1+1*1 = 64+32+8+4+2+1 = 111 B=111 A+B = 10101011 01101111 ------------ 00011010 , carry = 1 overflow occurs in A+B A-B = 00111100 If A=-85 and B=111, shouldn't A-B= -196? but this A-b=00111100 doesn't equal -196, since it starts with a 0. can someone explain why A-B=00111100?Explanation / Answer
A= 10101011
B=01101111
To find A-B , 1st convert B into 2's complement
2's complement of B= 10010001
A-B=
10101011
10010001
------------
00111100 , carry =1
=> 100111100
overflow occurs
A-B = 100111100
-256*1+128*0+64*0+32*1+16*1+8*1+4*1+2*0+1*0
= -256+32+16+8+4
=-196
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.