Introduction
Human beings use a number system consisting of different digits (0–9), which corresponds to the number of fingers we have. This representation is called the decimal number system.
Computers are digital devices (they don’t have fingers) so they use two states, either “0” or “1”, ON or OFF, True or False, High or Low. A computer understands the positional number system, where there are only a few symbols called digits, and these digits represent different values depending on the position they occupy in the number.
Definitions
- Number system: a set of symbols and rules used to represent numbers in a certain base.
- Base (radix): the number of different symbols used in a given number system. The largest value a digit in that system can have is always one less than the base — if the base is “b”, the largest digit value is “b − 1”.
- Binary digit (bit): made up of “0” or “1”. Bits are commonly stored and manipulated in groups of 4 (a nibble), 8 (a byte), 16 (a half word), 32 (a word), or 64 bits (a double word).
Types of Number System
Since binary numbers are too cumbersome for human beings to use, different systems were created by grouping bits into groups of three and four. The number systems most closely associated with computers are binary, octal, decimal and hexadecimal.
| Number system | Elements/symbols |
|---|---|
| Binary (base 2) | 0, 1 |
| Octal (base 8) | 0, 1, 2, 3, 4, 5, 6, 7 |
| Decimal (base 10) | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 |
| Hexadecimal (base 16) | 0–9, A=10, B=11, C=12, D=13, E=14, F=15 |
Conversion from Base 2 to Base 10
Conversion is the act of changing a number from one number system to another. To convert from base 2 to base 10, rank the digits from right to left starting at zero, then multiply each digit by its base raised to that position’s power.
Example 1: Convert (1011)2 to base 10.
1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = (11)10
Example 2: Convert (101.011)2 to base 10.
1×2² + 0×2¹ + 1×2⁰ + 0×2-1 + 1×2-2 + 1×2-3 = 4 + 0 + 1 + 0 + 0.25 + 0.125 = (5.375)10