Getting decimal value from binary number

133 Views Asked by At

I have the following binary number:

$$0.11001001000100000$$

$0$ is the sign and the rest is the mantissa.

I convert it into decimal $$0.785400390625$$ and by multiplying it by $4$ I get $3.1416015625.$

Now I need to do the same with

$$0.110010010000111111$$

By I'm not able to get the correct result because I need 18 decimals and my calculator doesn't allow this. Any ideas?

3

There are 3 best solutions below

0
On

So if $$ x_1=0.11001001000100000_2 $$ in binary, you know what $4x_1$ is in decimal. Now you have $$x_2=0.110010010000111111_2,$$ and you need to calculate $4x_2$.

This is really simple. A paper and pencil calculation (if mental arithmetic is not your forte) shows you that $$ x_1-x_2=0.000000000000000001_2=2^{-18}. $$ Therefore $$ 4x_2=4x_1-4\cdot2^{-18}=4x_1-\frac1{2^{16}}. $$ I'm sure your calculator can manage that.

0
On

Assuming you wanted to write $$0.110010010000111111\cdots$$

We can use

In binary $$0.111111111\cdots=1$$ Just like in decimal system, $$0.99999999\cdots=1$$

Proof $$0.1111111\cdots=0.11111111\cdots+0.00000000\cdots $$$$0.1111111\cdots=0.11111111\cdots+0.00000000\cdots1 $$ $$0.11111111\cdots=1.000000\cdots$$

Using the identity $$0.110010010000111111\cdots=01100100100010000$$

Or

IF YOU DIDN'T MEAN THAT

We can write, $$0.110010010000111111+0.000000000000000001=0.110010010001000000$$ Hence converting to BCD and multiplying by 4, $$x+\frac{4}{2^{18}}=3.141\cdots$$ $$x=3.141\cdots-\frac{4}{2^{18}}$$

0
On

You start with $$ x = 0.110010010000111111_\text{two}.$$ Multiplying by $4$ is just moving the binary point over two places: $$ 4x = 11.0010010000111111_\text{two}.$$

The first two digits represent $3.$

Now the rest: \begin{align} & 0.0010010000111111_\text{two} \\[10pt] = {} & \frac 1 {2^3} + \frac 1 {2^6} + \frac 1 {2^{11}} + \frac 1 {2^{12}} + \frac 1 {2^{13}} + \frac 1 {2^{14}} + \frac 1 {2^{15}} + \frac 1 {2^{16}} \\[10pt] = {} & \frac{2^{13} + 2^{10} + 2^5+2^4+2^3+2^2+2^1 + 1}{2^{16}} \\[10pt] = {} & \frac{8192 + 1024 + 32+16+8+4+2+1}{65\,536} = \frac{9279}{65\,536} \end{align}

Now you can do long division: $$ \begin{array}{cccccccccccccccc} & & & & & 0 & . & 1 & 4 & 1 & \\ \\ 65536 & ) & 9 & 2 & 7 & 9 & . & 0 & 0 & 0 & 0 & 0 & 0 \\ & & 6 & 5 & 5 & 3 & & 6 \\ \\ & & 2 & 7 & 2 & 5 & & 4 & 0 \\ & & 2 & 6 & 2 & 1 & & 4 & 4 \\ \\ & & & 1 & 0 & 3 & & 9 & 6 & 0 \\ & & & & 6 & 5 & & 5 & 3 & 6 \\ \\ & & & & 3 & 8 & & 4 & 2 & 4 & 0 \\ & & & & 3 & 2 & & 7 & 6 & 8 & 0 \\ \\ & & & & & 5 & & 6 & 5 & 6 & 0 & 0 \\ & & & & & \vdots & & \vdots & \vdots & \vdots & \vdots & \vdots \end{array} $$ $\ldots\,$and so on$\,\ldots$

( . . . and notice that there's no need to avoid the use of a calculator in doing this.)

PS: The process must terminate since the denominator, $65536,$ is a power of $2,$ and $2$ is a divisor of $10.$ It terminates at the step where the remainder is $0.$