# Converting Between Non-Decimal Bases?

How can a number in an arbitrary base be converted to another random base - for example from 9.2E9B03 base 17 to base 5? I would prefer a generalized procedure avoiding an intermediary base 10 conversion - which I already know how to do.

You can use the same process you use for converting to/from base 10 but you will have to do arithmetic in another base. $17_{10}=32_5$, so $0.2E9B03_{17}=\frac{2\cdot 32^5+30\cdot 32^4+14\cdot 32^3+21\cdot 32^2+3}{32^6}_5$ Now multiply out the numerator and do long division in base $5$ to get the part right of the fraction point. For the whole numbers you do the same thing without the division.

• If the old and new bases are both powers of the same prime number, the conversion is easily done through a "grouping" strategy. – J. M. is a poor mathematician Nov 23 '11 at 5:02
• @J.M.: true, but OP asked about random bases and the example had them not powers. – Ross Millikan Nov 23 '11 at 5:06
• I know, I was mentioning a special case where things are easier. (Clever use of) Horner's is the one to use for general conversions. – J. M. is a poor mathematician Nov 23 '11 at 5:10

If you can do arithmetic in either base, it is possible to convert.

For example, one can do repeated divisions by 5 in base 17, to get the base 5 number from the units. Or, one can feed the digits of base 17 into x'= 17x+d, to get the number in base 5.

Invoice arithmetic works for converting any columned system to any other. It relies on short division and multiplication.

For example, 1 acre costs £1. The first column then consists of the acre being divided into roods, 10 perches and perches. The price is likewise divided to 5/-, 1/3, and 1.5 d. One then buys so many acres, roods and perches at the listed price, so the conversion is done without recall to any base.

   1 acre    costs £1 0s 0d   3 acres cost      £3 0 0
1 rood   costs     5s 0d
10 perches costs    1s 3d   20 perches costs  £  2s 6d
1 perch   costs      1.5d   7 perches costs       10.5d
--------
£ 3 3s 4.5d


For the base-17 to base 5 example, one prices the cost of each 17th in base 5' and each second 17th, etc. You can run an alternating 4 as well, so tje expression in base 17, is a sum of 0.4, 0.1, 0.04, 0.01, etc. You then buy these like 9 = 2*4+1 etc.

    base 17      base 5                    base 5
9.2E9B03
4.000000     4.000000000      * 2 =   13.000000000
1.000000     1.000000000      * 1 =    1.000000000
0.400000     0.104201213      * 0 =    0.000000000
0.100000     0.014133413      * 2 =    0.033321332
0.040000     0.001313302      * 3 =    0.010000411
0.010000     0.000101034      * 3 =    0.000303212
0.004000
-                      ==============
14.04412410