How to do $-(1100.1)_2 - (1.010)_2$ using 1's complement

95 Views Asked by At

Convert $A = (12.5)_{10}$ and $B= (1.45)_{16}$ into binary format employing 6 bits for the integer part and 3 for the fractional part, including the sign bit. Perform $- A - B$ using 1's complement

First I converted $A$ and $B$ into binary. $A =1100.1$ and $B = 1.010$ . Then I made sure to have 6 bits including a sign bit and 3 bits in the fractional part. $A = 001100.100$ and $B = 000001.010$ where the first bit is 0 because $A$ and $B$ are positive. After I took the 1's complement of A and B which gives me: $[A]_1 = 110011.011$ and $[B]_1 = 111110.101$ then I added $[a] + [b] = 110010.000$ with a carry of $1$. after I added $1$ to the result which gives me $110011.000$. after that, since the sign bit is 1, it means I need to take the complement of my answer which is $- 001100.111$ which is $-12.875$ which is not a good answer. the good answer should be $-13.75$. I don't understand where I went wrong. I know that if I didn't add the carry then after taking the complement I would've had a good answer but I was told to always add the carry and if your answer should be negative take the complement and a negative sign. Why would this case be different? I don't want to memorize the steps, I want to understand.

1

There are 1 best solutions below

2
On BEST ANSWER

$$A = 001100.100$$ $$B = 000001.010$$

Evaluate $(-A) + (-B)$:

$$ -A = 110011.011$$ $$ -B = 111110.101$$ Hence, $$(-A) + (-B) $$ $$= (carry=1)110010.000 $$ $$=110010.000+\color{red}{000000.001}$$ $$=110010.001$$ $$= - (001101.110)$$ $$= - 13.75$$