How to convert a decimal (2^x) to binary?

189 Views Asked by At

Everything will be considered in 2's complement.

So from my understanding, since binary is base 2:

236 (decimal) = 1001002 (binary)

Apparently, my understanding was not very understanding.

236 = 10000000000000000000000000000000000002 (36 0's)

Would the bottom way still work to find 2-36?

Essentially: 10000000000000000000000000000000000002 ALSO after the inversions and addition of a 1

Would that mean 2-36 in decimal would essentially be inverting and adding a 1 to the original:

1001002 --> 0110112 --> 0111002

Then another thing is what would happen for:

5 x 2-23 (decimal) = ??? (binary)

I'm assuming something along the lines of binary multiplication, but not too sure about it.

1

There are 1 best solutions below

0
On BEST ANSWER

It is not hard to find a binary expansion for a positive integer by consecutively dividing it by $2$. For a positive fractional less than $1$, namely $x$, we can write the binary expansion by consecutively multiplying it by $2$. For example, let $x={1\over 3}$. Then $$x_1=\lfloor2x\rfloor=\lfloor{2\over 3}\rfloor=0\\x_2=\lfloor4x\rfloor-x_1=1\\x_3=0\\\vdots$$therefore$${1\over 3}=(0.01010101\cdots)_2$$

So, what about $1\over 2^n$?