You are on page 1of 4

Appendix F

Numbers in Binary, Octal, and


Hexadecimal Representations

For readers unfamiliar with binary and related bases, we digress here to
consider three important numerical systems besides the decimal (base 10)
system; these are binary (base 2), octal (base 8), and hexadecimal (base 16).
Obviously, the decimal system uses ten number symbols (0, 1, 2, 3, 4, 5, 6,
7, 8, 9) that multiply 10 raised to some exponent. The system is positional,
with columns to the left of the decimal point indicating increasing powers
of 10, and those to the right, decreasing powers. For example, 234.5 may be
written as (2)(102) + (3)(101) + (4)(100) + (5)(10–1) = 200 + 30 + 4 + 5/10 = 234.5.
Table F.1 illustrates the procedure.

TABLE F.1
Positional Number Representation in Base 10 (e.g., 234.5)
Exponent … 3 2 1 0 . –1 –2 –3 …
Exponential notation … 103 102 101 100 . 10–1 10–2 10–3 …
Decimal notation … 1000 100 10 1 . 1/10 1/100 1/1000 …
Decimal multipliers 2 3 4 . 5
Decimal sum 200 + 30 + 4 . + 5/10 = 234.5

By analogy, octal (base 8) uses an analogous scheme: eight number symbols


(0, 1, 2, 3, 4, 5, 6, 7) and a base of 8. To see what the octal equivalent of 234.5
is, we refer to Table F.2 and find that 352.48 = 234.5. The subscript after the
number indicates the base. Obviously, if there is no subscript we are referring
to base 10.

TABLE F.2
Positional Number Representation in Base 8 (e.g., 352.48 = 234.5)
Exponent … 3 2 1 0 . –1 –2 –3 …
Exponential notation … 83 82 81 80 . 8–1 8–2 8–3 …
Decimal notation … 512 64 8 1 . 1/8 1/64 1/512 …
Octal multipliers 3 5 2 . 4
Decimal sum 192 + 40 + 2 . + 4/8 = 234.5

609

© 2006 by Taylor & Francis Group, LLC


610 Modeling of Combustion Systems: A Practical Approach

Base 2 is ideal for constructing factorial designs because the system com-
prises only two states for any factor: high and low. In base 2, the only
numbers we may use are 0 or 1. (We can use – and + in lieu of numeric
symbols, but the point is that we only have two symbols at our disposal.)
As an example of binary math, the decimal number 14.75 is equivalent to
1110.112. Table F.3 shows why.

TABLE F.3
Positional Number Representation in Base 2 (e.g., 1110.112 = 14.75)
Exponent … 3 2 1 0 . –1 –2 –3 …
Exponential notation … 23 22 21 20 . 2–1 2–2 2–3 …
Decimal notation … 8 4 2 1 . 1/2 1/4 1/8 …
Binary multipliers 1 1 1 0 . 1 1
Decimal sum 8 + 4 + 2 + 0 . + 1/2 + 1/4 = 14.75

To find the octal equivalent for 14.75, we could go through the same routine
as before. However, we can take a shortcut whenever two bases are related
by the formula base B = base (A)n where A, B, and n are integers. In such a
case, we may group the base A symbols in groups of n and convert each
group directly to its base B equivalent. In the present case, base 8 = base 23.
Therefore, we can group the base 2 symbols in groups of three (starting from
the octal point and moving in each direction) and then convert each to its
octal representation. For example, 1110.112 = 1,110.1102 = 16.68, because
12 = 18, 1102 = 68. Conversion to base 4 follows the same pattern: base 4 = 22,
so grouping 1110.112 in groups of two gives 11,10.112 = 32.34, since 112 = 34
and 10 = 24.
For bases less than 10, we use a subset of the base 10 numerical symbols.
For bases greater than 10, we use letters as additional numerical symbols.
Thus, for base 16 we augment the symbols 0 through 9 with A = 10, B = 11,
C = 12, D = 13, E = 14, and F = 15. So a number like 234.5 equals EA.816 using
the process already shown. But conversion of EA.816 to related bases is much
simpler: EA.816 = 352.48 = 32,22.24 = 11,0010,1011.12. To find this, we first con-
vert to base 2 using Table F.3. From it we note that E = 1110, A = 1010, and
8 = 1000. Putting these in series and eliminating leading and trailing zeros
after the binary point, we have 1110,1010.1, and this is indeed the base 2
representation EA.816 or 234.5, base 10.
Delimiting the numerals in groups of threes (always beginning from the
binary point and proceeding in either direction) rather than fours gives
11,101,010.100. Converting these to their octal equivalents gives 352.48.
Delimiting the binary number in groups of twos gives 11,10,10,10.10. Con-
verting these to their base 4 equivalent yields 32,22.24. Table F.4 may make
the procedure easier.

© 2006 by Taylor & Francis Group, LLC


Numbers in Binary, Octal, and Hexadecimal Representations 611

TABLE F.4
Base Equivalents
Base
10 16 8 4 2
0 0 0 0 0
1 1 1 1 1
2 2 2 2 10
3 3 3 3 11
4 4 4 10 100
5 5 5 11 101
6 6 6 12 110
7 7 7 13 111
8 8 10 20 1000
9 9 11 21 1001
10 A 12 22 1010
11 B 13 23 1011
12 C 14 30 1100
13 D 15 31 1101
14 E 16 32 1110
15 F 17 33 1111
16 10 20 100 10000

Example 3.1 Conversion of Numbers among Bases

Problem statement: Convert 100 to its hexadecimal equivalent.


Then convert the hexadecimal number into the bases 2, 4, and 8.
Which conversions are easier? Why?

Solution: We use the following methodology:

Step 1: Ten is not an integer power of 2; therefore, we find the


largest power of 16 that is less than 100: 160 = 1, 161 = 16, 162
= 256.
Step 2: Divide 100 by the largest integer power of 16 and retain
the integer. This will be the first hexadecimal digit: 100/16 =
6.25 (use 6).
Step 3: Subtract 6016 from 100 by converting to base 10: 6·16 = 96.
Subtract this from 100, leaving 4.
Step 4: Repeat the process until closure: 100 – 96 = 4. Therefore,
100 = 6416, and we are done.

Now that we have found the hexadecimal equivalent, we may


convert this directly to binary integers one integer at a time: 6416 =
110,0100. Regrouping in threes gives 1,100,100, which converts to
1448. Regrouping in twos gives 1,10,01,00, which yields 12,104.

© 2006 by Taylor & Francis Group, LLC


612 Modeling of Combustion Systems: A Practical Approach

Clearly, the latter method is easier, but it is only possible if an


integer power relates the bases. Conversely, because 16, 8, 4, and
2 relate by integer powers, one can convert among them with
relative ease.

An Apologetic for Octal


In the usual case, humans possess 10 digits, 5 on each hand. Our counting
system seems to derive from this. The linguistic term betrays an association
— we use the term digits to refer to either fingers or numerals. Were our
counting system to have ignored thumbs, it may have grown to become octal
rather than decimal. This would have some advantages. First, it is much
easier to convert octal to binary or hexadecimal — the arithmetic of com-
puters. Second, 24 hours (308) would equal three revolutions on a clock
(numbered 0, 1, 2, 3, 4, 5, 6, 7), dividing the work–rest–play cycle evenly.
And instead of counting only to 10 with our fingers and thumbs, we would
be able to count to 24 (308) using our fingers to represent units and thumbs
to represent octals. The ancient tally system of counting is somewhat closer
to this procedure in the sense that it uses four vertical strokes to represent
numbers up to 4 and one cross-stroke for the number 5. This is actually a
base 5 system, and it unmistakably resembles the four fingers and one thumb
of the human hand. The leap to base 10 (two hands) is not so hard to imagine.
Considering their love for the number 7, one would have thought that the
ancient Hebrews and their predecessors would have preferred octal to dec-
imal, since it gives 7 as the largest numeral.* The relationship between a 24-
hour day and a 360° rotation of the Earth gives 15° per hour; octal would
have allowed a slightly more precise division into 384° (6008°), each hour
representing 16° of Earth’s rotation (208°), making angles easier to repeatedly
bisect. So, the Greeks with their love for geometry and integers should have
loved such a system. An octal world is a world where children never labor
to convert fractional measures; they become trivial: 1/2 = 0.48, 1/4 = 0.28, 1/8
= 0.18, 1/16 = 0.048, 1/32 = 0.028, 1/64 = 0.018, etc. Even music with its octave
scales and whole, half, quarter, eighth, and sixteenth notes would be better
served by an octal system. Alas, for all these advantages and ancient possi-
bilities, we live in a decimal world, not an octal one. But is it too much to
hope for change? The metric system has unified and harmonized scores of
other units and divisions. The French still count by 20s (e.g., 90 is spoken
quatre vingt dix, literally “four 20s, 10”). Perhaps an octal future is not so far-
fetched. The author eagerly awaits this brave new world (along with the
return of the slide rule, which, by the way, would be easier to construct).

* This is attested to in various Hebrew literature. For example, see various books of the Bible,
such as Genesis 2:1, 7:2, Exodus 20:10, and Revelation 1:12–20, 5:5, 8:6, 10:4, 15:1, 16:1.

© 2006 by Taylor & Francis Group, LLC

You might also like