Numbers in $-A - (-B)$ form for $ 2's$ Complement

30 Views Asked by At

I know for $2's$ complement representation, you are supposed to perform an operation like $A - B$ into addition but perform $2's$ complement on $B$.

So $0101 - 1001 = 0101 + 0111$

Now, if I had a question in the form of $-A - (-B)$, would I combine the signs and it would become $-A + B$, or would I do $2's$ complement on $-B$ and get $-A - B$?

1

There are 1 best solutions below

0
On BEST ANSWER

Having $n$ digits in $2$s complement representation we define complement of number $A$, between $1$ and $2^n-1$, by formula $-A=2^n-A$.

So $-A - (-B)$ is same with $-A +B$: $$-A - (-B) = 2^n-A +(2^n- (2^n-B)) = 2^n-A+B=-A +B$$