This post details how to work with arbitrary bases in a positional numeral system (e.g., decimal, binary, etc.). Specifically, this post details how to convert numbers from base 10 to base in such a way that not only is the whole number portion converted but also the fractional/radix portion as well.
Much of the discussion that follows has been taken from .
Arbitrary bases (description)
We recall that to represent a number in a positional numeral system with base we need basic symbols for the integers zero up through . Even though the base is such an important part of our culture, the choice of 10 is really quite arbitrary, and other bases have great practical and theoretical importance. If , we may use our ordinary digit symbols; thus, for example, we may consider 3012 as a number expressed to base 4 with the basic symbols 0, 1, 2, 3. To make clear that the number is considered as expressed to base 4, we shall write it as . When no subscript is written, it will be understood in this treatment that the number is expressed to the ordinary base 10. If , we must augment our digit symbols by some new basic symbols, for we always need basic symbols. If , therefore, we may take 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, , for our basic symbols, where and are symbols for ten and eleven; for example, we might have .
It is easy to convert a number from a given base to the ordinary base 10. Thus, we have
If we have a number expressed in the ordinary scale, then we may express it to base as follows. Letting be the number, we have to determine the integers in the expression
where . Dividing the above equation by , we have
That is, the remainder of this division is the last digit in the desired representation. Dividing by , we obtain
and the remainder of this division is the next to the last digit in the desired representation. Proceeding in this way, we obtain all the digits . This procedure can be systematized quite conveniently, as shown below. Suppose, for example, we wish to express 198 to the base 4. We find
The desired representation is . Again, suppose we wish to express 6647 to the base 12, where and are employed to represent ten and eleven, respectively. We find
The desired representation is .
One is apt to forget, when adding or multiplying numbers in our ordinary system, that the actual work is accomplished mentally and that the number symbols are used merely to retain a record of the mental results. Our success and efficiency in carrying out such arithmetic operations depend on how well we know the addition and multiplication tables, the learning of which absorbed so much of our time in the primary grades. With corresponding tables constructed for a given base , we can similarly perform additions and multiplications within the new system, without spending any time reverting to the ordinary system.
Let us illustrate with base 4. We first construct the following addition and multiplication tables for base 4.
The addition of 2 and 3, therefore, by reference to the table, is 11, and the multiplication of 2 and 3 is 12. Using these tables, exactly as we are accustomed to using the corresponding tables for base 10, we can now perform additions and multiplications. As an example, for the multiplication of by we have, omitting the subscript 4,
Considerable familiarity with the tables will be needed in order to perform the inverse operations of subtraction and division. This, of course, is also true for the base 10 and is the reason for much of the difficulty encountered in teaching the inverse operations in the elementary grades.
Radix fractions (description)
Before attempting problems in the next section concerning radix fractions, it may help to make some general number representation explorations first. We see in  that any whole number can be written uniquely in the form
where . We can roughly and informally represent any number in base as follows:
Such a number would notationally be represented as (base ). It is worth noting that the fraction may go on indefinitely (as is the case with ), and the little dot
. between and is referred to as the "radix point" or simply the "decimal point" when working with conventional base 10 numbers. Converting the number 12.112 (base 3) to base
10 is fairly simple if we just follow the informal representation given above:
More formally, suppose we want to represent a general number in base that accounts for both its whole number and fractional portions. We could write as
where the idea is that and effectively serve as upper and lower bounds, respectively, with serving as the highest power of base needed to represent the number in question and the magnitude of serving as how many digits to the right of the radix point we want to record (e.g., the hundredth place for a decimal fraction would be represented by places to the right of the decimal point). Hence, the whole number portion of could be represented by while its fractional portion could be represented by .
All of this is a bit theoretical. What would this look like in practice? We can use our work above in converting to base 10 as an example. Since the highest power of 3 needed to represent this number is 1, we have . Since we have 3 digits to the right of the radix point, we have . Our generalized notation gives us the following:
Converting a number from base 10 to another base is somewhat trickier. The method for converting a base 10 number to another base is conveniently described in the previous section, but this method only works for those numbers to the left of the decimal point (whole numbers). We need to deal with the numbers to the right of the decimal point (the "fraction part"). To do this, we use a different and sort of backward version of the original method described in the previous section. The original method starts by dividing the number by the base , and we then use the remainders to form the desired number in base . We arrange the new number by putting together the remainders from bottom to top. This works for whole numbers.
To convert the fractional part of a number to another base, we must essentially use the method above in "reverse." We take the fractional part of the number (the portion to the right of the decimal or radix point) and multiply it by . The integer parts that result from these multiplications play the same role that the remainders played when dividing by base in order to convert a whole number to a different base. We proceed to multiply whatever fractional part is left and we produce the number in the specified base in this way.
For example, to convert the number 14.73 to base 3, we must do the following: we first start out with the portion of the number to the left of the radix point (the whole number portion):
Assembling the remainders from bottom to top, we get 112 in base 3. That takes care of the whole number portion of 14.73. We must now convert .73 to base 3 to finish the complete conversion. As described above, the fractional conversion is basically the reverse of the previous method in the sense that now we will be multiplying by base , keeping the resultant integer parts, and then assembling these parts from top to bottom instead of bottom to top:
As seen above, we arrange the integer parts from top to bottom to get the fractional portion in base 3. Thus, we have the following (note that we could write down more fractional digits had we continued the process above):
In a nutshell, the method used above is the one you will want to use for converting the fractional part for a number in base 10 into base . The following section provides a more formalized description of this process.
Expressing a number N in base b
If we have a number that is expressed using base 10, then we may express it using base if we can determine the integer values of
in the expression
where and the integer or whole number portion of , as noted in braces above, is given by
while the fractional portion of is given by
One will usually specify how many digits after the radix point are desired, thus eliminating the need for the trailing in the representation of the fractional portion of .
To effectively express using base , we need to employ a method that first converts the whole number portion of into base and then subsequently converts the fractional portion of into base . We may then link together the results of these conversions to express the entire number in base . To start, let us write , where represents the whole number portion of , and represents the fractional portion of .
Converting the whole number portion of N into base b
First write out the expression for the whole number portion of (we omit for the sake of clarity since , and we also express as simply ):
Dividing the equation above by gives us the following:
That is, the remainder of this division is the last digit in the desired representation.
Recall the division algorithm stated at the beginning of this section. We let represent the dividend (the number to be divided), the divisor (the number doing the dividing), and the claim was that unqiue integers and existed such that , where . We call the quotient and the remainder.
In our case, is the dividend (the whole number portion of to be divided), and is the divisor (the number doing the dividing). The following way of rewriting may more clearly illustrate why is the remainder when dividing by :
If we use as the new dividend (and keep as the divisor), then we get the following:
We continue this process until we obtain a quotient that is less than our base; that is, using the language of the division algorithm, we continue this process until we obtain a dividend that is less than its divisor. At that point, the "final quotient" is simply 0 and the remainder is the last quotient we obtained that is less than our base.
This procedural flow is pictured in the figure where the integer part of
14.73 is being converted to base 3:
The upshot of all of this is that we can proceed in the way outlined above to obtain all the digits . The figure above simply provides a convenient systematization of the procedure.
We obtain all the digits by proceeding in this manner (elaborated on in the note above).
Converting the fractional portion of N into base b
First write out the expression for the fractional portion of :
If we multiply the equation above by , then we get the following:
Recall that ; that is, is an integer. The expression above, namely , shows that and represent the resultant integer and fractional portions of the multiplication of by , respectively. Of course, we can continue the process outlined above to obtain more fractional digits:
Proceeding in this way, we obtain the digits , but we could go on obtaining digits indefinitely, as the process above indicates. Consider again the following picture (shown previously), which shows how to convert the fractional portion of
14.73 to base 3:
The reason why the procedure above works should now make much more sense logically.
Radix fractions (problems)
The following problems are taken from .
Fractional numbers can be expressed, in the ordinary scale, by digits following
a decimal point. The same notation is also used for other bases; therefore, just
as the expression
.3012 stands for
the expression stands for
An expression like is called a radix fraction for base . A radix fraction for base 10 is commonly called a decimal fraction.
Radix fraction to decimal fraction
Problem: Show how to convert a radix fraction for base into a decimal fraction.
Solution: Consider the following number in base :
To convert a radix fraction for base into a decimal fraction, we simply use the expression for the fractional portion above and substitue in the -value for whatever base we are using. Thus, to express as a decimal fraction, we simply write
Decimal fraction to radix fraction
Problem: Show how to convert a decimal fraction into a radix fraction for base .
Solution: To convert a decimal fraction into a radix fraction for base , we use the method outlined in the section above (i.e., the section about converting the fractional portion of a number into base ).
Approximate radix fractions as decimal fractions
Problem: Approximate to four places and as decimal fractions.
Solution: Consider the following:
: We may approximate out to four decimal places as follows:
: We may approximate out to four decimal places as follows:
when we substitute the values and into the fractions above.
Approximate a radix fraction in other bases
Problem: Approximate to four places
.4402 as a radix fraction, first for base
7, and then for base
Solution: Consider the following:
0.4402as a radix fraction for base
Since we are only instructed to approximate out to four places, the above is satisfactory; of course, we could continue the process and obtain an even better approximation if we wanted.
0.4402as a radix fraction for base
As above, we may stop once we have approximated out to four places, thus concluding the problem.