Box 2: Binary-coded decimal
The coding system described in Section 2.2 is known as the natural binary coding system. It uses the binary counting numbers 0, 1, 10, 11, 100, etc., to encode the denary counting numbers 0, 1, 2,
3, 4, etc.
There is an alternative coding system which is sometimes used. It is known as binary-coded decimal or BCD. Here each digit of a denary number is coded by its 4-bit binary equivalent. This results in as many 4-bit code words as there
are digits in the original denary number. So for example denary 25 is encoded as:
0010 (two) then 0101 (five)
and denary 139 as:
0001 (one) then 0011 (three) then 1001 (nine).
In a computer with, say, a 16-bit word length, four BCD code words can be packed into a single computer word if desired. Alternatively
each code word can form the least-significant four bits of a 16-bit word, with the other bits set to 0. It is important to
make a decision on this point in each individual application, and then adhere to it.