3

I tried this before here Convert 34.2111 (decimal) to binary and now I am trying again in a different way.

When you have to convert base a to b where b is a^n you know that n digits of the number in base a = 1 digit in base b. In this case 10 isn't a power of 2 so at best you get $10 = 2^3+2^1$

What this means is that each digit of the given number in base 10 corresponds to 3 digits plus.... something? in base 2.

I did a correspondence table: $$0_{10} = 0_2\\ 1_{10} = 001_2 \\ 2_{10} = 010_2 \\ 3_{10} = 011_2 \\ 4_{10} = 100_2 \\ 5_{10} = 101_2 \\ 6_{10} = 110_2 \\ 7_{10} = 111_2 \\ 8_{10} = 1000_2 = 111_2+1_2 \\ 9_{10} = 1001_2 = 111_2+10_2$$

When I solve exercises like this base b is usually a power of a so I don't "add" anything. I write the correspondences up until n+1 digits (exclusive). If this was base 8 instead of decimal I'd only need to write the correspondences until 111_2. When solving this I noticed that the 3 (from the 34) doesn't correspond to 011_2 or 0011_2 but instead to 011_2+1_2=100_2 (because I do this as if I am solving for base 8 and then I add as if I am solving for base 2... because 10 = 2^3+2^1). So basically... 2 to the power that gives you the number closest to 10 (which is 8) and then add what's missing, which is either 0, 1 or 2 (decimal).

Using this I get:

$$3 = 011_2 + 01_2 = 0100_2 \\ 4 = 0100_2 + 00_2 = 0100_2 \\ 34 = 0100 0000_2 + 0000 0100_2 = 0100 0100_2$$

Only... the answer is 100010 (I'm only counting the integer part to keep it simple).

If I try to solve the decimal part I get:

$$2 = 0010_2 + 00_2 = 0010 \\ 1 = 0001_2 + 01_2 = 0010 \\ 2111 = 0010 0010 0010 0010$$

And this is... wrong.

I know that each unit/digit of that number in decimal is $0111 + 10 = 1001_2$ in binary because what you do is use a power of 2 and then add what's left.. when b is a power of two you don't have to add anything because there's nothing missing. Here it's trickier... if $10 = 2^3+2^1 = 2(2^2+1)$ then maybe a different way of doing this is solving the given digit in base 8, add a zero to the left and then add the excess (mod) to the closest power of 2... in the case of 3 it's one or 01_2 because the closest power is 2...

TL;DR I am trying to find a faster way of converting this than the one in the given link. I know it works but it's too messy. I am trying to apply the method I use for a -> b where b is a power of a but this time with non powers of a. Can anyone help me develop "my" method so I can apply it to these cases too?

2 Answers2

2

Deal with the integer $34$ and the fraction $0.2111$ separately.

For the first, use repeated division by $2,$ tracking remainders, to find $34÷2=17, \text{rem} \,0; 17÷2=8\text{rem}\,1; 8÷2=4\text{rem}\, 0; 4÷2=2, \text{rem}\, 0; 2÷2= 1,\text{rem}\, 0; 1÷2=0,\text{rem}\, 1.$ The remainders, read in reverse, give the number $100010.$ This is usually set up neatly in a table, but I don't know how to draw it up using MathJax.

For the fraction, use repeated multiplication by $2,$ tracking whatever becomes whole. Thus we have $0.2111×2=0+0.4222;0.4222×2=0+0.8444; 0.8444×2=1+0.6888;0.6888×2=1+0.3776;0.3776×2=0+0.7552;0.7552×2=1+0.5104;0.5104×2=1+0.0208;0.0208×2=0+0.0416;0.0416×2=0+0.0832;0.0832×2=0+0.1664;0.1664×2=0+0.3328;0.3328×2=0+0.6566;0.6566×2=1+0.3312;\dots,$ until it ends or begins to repeat. Then the corresponding bicimal is, from the beginning $0.0011011000001\dots.$ This is also more neatly set up in tabular form.

So in sum, the number in base two begins $100010.0011011000001\dots.$

Allawonder
  • 13,327
0

$$34.2111\times2^{14}=560514.6624\cdots$$

and

$$560514=‭10001000110110000010‬_b.$$

Hence $$‭100010.00110110000010$$