[Math] binary representation of a fraction in two’s complement

binarynumber-systems

Could any one please explain what is a 16-bit two's-complement representation of -0.375 and the steps to calculate it? Also, what happens if I convert it back to decimal?

Thanks

Best Answer

I try to offer my suggestion and it should not be taken as solution because I am not sure it is correct or not.

Notation: $[n]$ is called the greatest integer function. It is used to extract the integral part of the number $n$. Example: $[4.78] = 4$.

Step-1 … Convert $0.375$ to binary first.

--------- Multiply $0.375$ by $2 = 0.75$----record the result of $[0.75]$ as $A$, which is $0$ in this case.

--------- Let $X = 0.75 – [0.75] = 0.75 – 0 = 0.75$.

--------- Multiply $X$ by $2 = 1.5$----record the result of $[1.5]$ as $B$, which is $1$ in this case.

--------- Let $Y = 1.5 – [1.5] = 0.5$

--------- Multiply $Y$ by $2 = 1.0$----record the result of $[1.0]$ as $C$, which is $1$.

--------- Let $Z = 1.0 – [1.0] = 0$ and the process can be stopped as $0$ has been reached.

--------- $0.375_{(10)} = 0.ABC_{(2)} = 0.011_{(2)}$; where $A, B, C$ are digits of a number.

--------- [Check: $0.011_{(2)} = 0*2^{-1} + 1*2^{-2} + 1*2^{-3} = … = 0.375$]

Step-2 … Attach thirteen $0$’s to your result such that $0.375_{(10)} = 0.0110 0000 0000 0000_{(2)}$

Step-3 … Do the negation part (ie. The $2$’s complement part)

--------- Perform an $1$’s complement. Result $= 1.1001 1111 1111 1111_{(2)}$

--------- Add $1$ to the result and get $1. 1010 0000 0000 0000_{(2)}$.