(
octal)
or 4-bit groupings (
hexadecimal)
, starting at the right of the number. For example, starting with the binary number 100110102, we derive its octal and hexadecimal equivalents as follows: To see why this grouping strategy is correct, let's look at a generalized representation of a binary number and how we convert it to a hexadecimal number. We assume that the binary number always has a multiple of 4 bits. Of course, for any binary number, we can prepend additional zeros to the most significant bits to make this assumption true.
The generalized representation is shown below. The binary number starts out with n bits and will be converted to a hexadecimal number with k = n/4 hex digits:
The process of putting the bits into groups of four is equivalent to factoring powers of 16 within the expression. By doing the grouping, we can rewrite the generalized expression as follows:
We can now rewrite each of the 4-bit numbers in the parentheses as a single hexadecimal digit, raised to an appropriate power of 24. We could apply a similar method to demonstrate why grouping by threes performs the conversion from binary to octal.
2328 maps into the binary number 010 011 0102, which can be re-grouped to form the number 9A16. The mapping from hex to octal works analogously.
The same method works for conversion from base 10 to other bases. For example, to convert 15410 to base 8, we proceed as follows:
The conversion to base 16 works like this:
The Theory Behind Successive Division Given that the number N in base 10 is equivalent to an n-digit number in a different base R, we should be able to rewrite N in base R as (
an-1 an-2 a0)
R. As we successively divide by R, each subsequent division liberates the next lower-order digit ai from the base R representation.
To see this, consider the following description of successive division. Since N is represented as an n-digit number in base R, the first division yields the quotient Q0 and the remainder a0. The latter is exactly the value of the lowest-order digit in base R. Dividing R into Q0 results in a new quotient Q1 and a new remainder a1, the next lowest-order digit. If we repeat the process n times, we obtain a quotient of zero and a remainder that is equal to the highest-order digit in base R. The process of successive division is shown below:
To summarize, Figure A.1 shows the various conversion methods that we have covered. We use successive division to convert from base 10 to any other base. By expanding the positional notation, we can convert from any base to base 10. We perform conversions between base 2 and other bases that are powers of two, such as base 8 and base 16, through the process of bit grouping.
[Top] [Next] [Prev]