Skip to content

Computer Science · Ch 2 — Encoding Schemes and Number System

Number System

2.2

Number System

So far we have seen that each key of the keyboard — a character, a special symbol, a function key — is internally mapped to an ASCII code by an encoding scheme, and that this code is then converted to its equivalent binary representation for the computer. Look again at the mapping for the key A: the code 65 belongs to the decimal number system, while its equivalent 1000001 belongs to the binary number system. To understand such representations properly, we need the idea of a number system itself.

What is a number system?

A number system is a method to represent (write) numbers.

  • Every number system has a set of unique characters or literals (its digits/symbols).
  • The count of these literals is called the radix or base of the number system.

Four number systems matter in the context of computers (Figure 2.2):

Number systemBaseLiterals it comprises
Binary20, 1
Octal80, 1, 2, 3, 4, 5, 6, 7
Decimal100, 1, 2, 3, 4, 5, 6, 7, 8, 9
Hexadecimal160–9 and A–F

Each of these is explained in the subsections that follow (2.2.1–2.2.5).

Positional number systems

These systems are also called positional number systems, because the value contributed by each symbol (digit or letter) depends on its position within the number. A number may also carry a fractional part, just like the decimal numbers we use every day.

The position numbers are assigned like this:

  • In the integer part, the right-most symbol has position 0, and the position value increases by 1 from right to left (0, 1, 2, ...).
  • In the fraction part, the first symbol after the point has position −1, and the position decreases by 1 reading left to right (−1, −2, −3, ...).

Positional value

Each symbol has a positional value, computed from its position number and the base of the number system: the positional value is the base raised to the position number. For example, the symbol at position 3 in the decimal system (base 10) has positional value 10^3.

The number itself is recovered by adding up (symbol value × positional value) over all its symbols.

For the decimal number 123.45 (Figure 2.3):

Figure 2.2Four different number systems
Fig. 2.2 — Four different number systems

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

This figure is a one-glance map of the four number systems used in the context of computers.

At the centre sits a dark-green rounded badge labelled "Number System for Computers". From the four corners, four light-green banner strips point inward toward the central badge (each banner is arrow-notched toward the centre), and each banner names one number system with its two defining facts — its base and the literals it comprises:

  • Top-left — Binary: Base 2, comprising the digits 0 and 1.
  • Top-right — Hexadecimal: Base 16, comprising 0–9 and the letters A–F.
  • Bottom-left — Decimal: Base 10, comprising the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
  • Bottom-right — Octal: Base 8, comprising the digits 0, 1, 2, 3, 4, 5, 6, 7. …
Figure 2.3Computation of decimal number using its positional value
Fig. 2.3 — Computation of decimal number using its positional value

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

This figure demonstrates, digit by digit, how the value of the decimal number 123.45 is built from positional values — the core mechanism of every positional number system.

It is drawn as a compact three-row table, with the row labels in dark-green header cells on the left:

  • Row 1 — Digit: the number spread out as separate symbols: 1, 2, 3, ., 4, 5.
  • Row 2 — Position Number: the position assigned to each digit: 2, 1, 0 for the integer digits (counting up right-to-left from the units place), nothing under the decimal point itself, then −1, −2 for the fractional digits (counting down left-to-right after the point).
  • Row 3 — Positional Value: the base raised to each position number: (10)^2, (10)^1, (10)^0 for the integer part and (10)^-1, (10)^-2 for the fractional part.

Below the table, a note states the rule the whole figure exists to teach: add the product of each positional value and its corresponding digit to get the decimal number. The worked line then carries it out:

1 x 10^2 + 2 x 10^1 + 3 x 10^0 + 4 x 10^-1 + 5 x 10^-2 = (123.45)10

That is, 100 + 20 + 3 + 0.4 + 0.05 reconstructs exactly 123.45. …