these binary numbers in 2's complement is given 11010100 - 11101011 , perform the operation what I did it negated 11101011 so I can perform addition and see if any overflow occur.. I've already did it and got 11101000 the problem is when you convert it to decimal it's -44-(-21) so it's -23 but my result is -24 !! , what's the problem ?
\[\begin{align*}11010100_2&=2^7+2^6+2^4+2^2\\ &=212_{10} \end{align*}\] \[\begin{align*}11101011_2&=2^7+2^6+2^5+2^3+2^1+2^0\\ &=235_{10} \end{align*}\] Then \(212-235=-23\).
I know that man please read my question again :(
Well you said you got -24, not -23.
That's why I asked , try solving it and I think you'll get the same result :( Am I missing something ? I think I solved it right but the final result wasn't
Hmm, I've never actually computed with negative binary numbers - what do you mean by negating the second number?
Well , I've read that when you're trying to check if an overflow occur you should add 2 numbers which will be in 2's complement and in my case it was a subtracting operation so i had to negate it.
you actually have to add one ? that's strange the question says it's already in 2's complement , my head hurts :( I think I should add one to fix this.
Yup it works after adding one. sorry for wasting your time.
After a quick search, I'm going to have to correct myself. \[11010100=-(2^6+2^4+2^2)=-84 \] \[11101011=-(2^6+2^5+2^3+2^1+2^0)=-107 \] We're restricted to six bits, so we can go as high as \(0111111_2=+63_{10}\) and as low as \(1000000_2=-64_{10}\). I haven't looked over the overflow aspect, but since you have it figured out... And don't worry about it! Here to help any way I can.
Join our real-time social learning platform and learn together with your friends!