How convert 1/2 to binary?

7k Views Asked by At

How convert 1/2 to binary? isn't it 0.1111 $1/2$ result $0$ $(1/2)*2=1$ result $0.1$ $2*2>1$ result $0.11 $ etc.

1

There are 1 best solutions below

0
On

To expand upon Gerry Myerson's excellent comment,

If you're working in base 10, and want to get 1/10, you do two steps, as shown in the diagram below

  • Write the numerator, 1, as 01. (add in the decimal point and a leading zero)

  • Move the decimal point one space to the left, to get 0.1

enter image description here

So if you're working in base 2, and want to get 1/2, you need to do similar: write 1 in base 2, add the binary point and leading zero, and then move the binary point.


Each digit to the right of the binary point is some negative power of 2. So

$$ \text{binary } 0.1111 = 0\times2^0 + 1\times2^{-1} + 1\times2^{-2} + 1\times2^{-3} + 1\times2^{-4}$$

In decimal this is 0.9375. The more 1s you add after the binary point the closer you get to 1.


In case you're wondering how 1/2 is stored in a computer it is held in "scientific notation" style:

$$ 1/2 = 1 \times 2^{-1}$$

The computer stores the mantissa (1) and the exponent($-1$). (In the case of signed numbers things are a little more complicated. Easy to find info on the internet, e.g. here.)