Number and Number Systems
A number system is a way to represent numbers.
Ten is an important number for us humans. Most of us have ten of fingers and toes, and we certainly prefer to have all ten of each. Because the fingers are convenient for counting, people started using their fingers to count from 1 to 10. It is decimal system, which is also called base-10 number system. Even if a lot of number systems are in base 10, human did not always count in base 10 and we are still using other numeral bases. Here are few examples:
- Base-60 counting system is still used today with this "60 seconds in a minute; 60 minutes in a hour".
- Base-24 system is used for counting 24 hours to be one day.
- Base-12 system is used for counting one dozen.
Figure 1: Ten fingers on two hands, the possible starting point of the decimal counting
If humans had 6 fingers on their hands, would we be using the Senary system (also known as heximal or Seximal) of numbers?
In a digital system, each digit (bit, wire) has only two possible values: 0 or 1. It is called Binary, or base-2 number system. If there is a longer binary number, for example: (101110100101)_{binary}, it is not suitable for humans to remember it, and it is easily confused. One good way reducing the length of binary number is grouping consecutive binary digits into groups of other number system. Therefore, we are using Octal (a base-8 number system) and Hexadecimal (a base-16 number system) to represent a binary number in the digital system.
In mathematics, a 「base」 or a 「radix」 is the number of different digits or combination of digits and letters that a system of counting uses to represent numbers. ~Wiki~
Decimal
Characteristics of the decimal number system are as follows:
- Also called denary
- Base-10
- Uses decimal digits: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
- Positional System — position gives power of the base
- Example:
3845.2 = (3 x 10^{3}) + (8 x 10^{2}) + (4 x 10^{1}) + (5 x 10^{0}) + (2 x 10^{-1}) - Positions: …5 4 3 2 1 0 . -1 -2 -3 …
The base-10 system is a Positional Number System. it means each digit has s different value according to its positions. For example: 255 is (2 x 100) + (5 x 10) + (5 x 1). There are a lot of other numeral systems which does not work that way. One of most famous is Roman numerals, which is not really a positional system. In the Roman number system,The X stands for 10, the V stands for 5, and the I is a one. Twenty-seven in Roman numerals is XXVII ; it is 10 + 10 + 5 + 1 + 1 = 27 in decimal.
Decimal | Binary | Octal | Hexadecimal |
0 | 0 | 0 | 0 |
1 | 1 | 1 | 1 |
2 | 10 | 2 | 2 |
3 | 11 | 3 | 3 |
4 | 100 | 4 | 4 |
5 | 101 | 5 | 5 |
6 | 110 | 6 | 6 |
7 | 111 | 7 | 7 |
8 | 1000 | 10 | 8 |
9 | 1001 | 11 | 9 |
10 | 1010 | 12 | A |
11 | 1011 | 13 | B |
12 | 1100 | 14 | C |
13 | 1101 | 15 | D |
14 | 1110 | 16 | E |
15 | 1111 | 17 | F |
16 | 10000 | 20 | 10 |
Conversions between Different Number Systems
Humans want to see and enter number in decimal, but computers must store and compute with bits. Therefore, we need to know how to convert a number into different number systems.
Base-r Numbers to Decimal
To convert any base-r number to decimal:
- Expand base-r number using positional scheme
- Perform computation using decimal arithmetic
Base-r system to decimal system:
- Determine the positional value of each digit (this depends on the position of the digit and the base of the number system)
- Multiply the obtained positional values (in step 1) by the digits in the corresponding positions.
- Sum the products calculate in Step 2. The total is the equivalent value in decimal.
Basically, the number systems can be cataloged into two groups: decimal and binary systems.
Figure 1: Number Systems
We can easily convert numbers between decimal and binary systems. If you need to convert a BCD number to another system, such as octal, the best solution is to convert the BCD number it to decimal first, then convert to binary, and finally to octal number.
Common Powers
Most of common powers of base-10 and base-2 number system are shown as follows:
Power | Preface | Symbol | Value |
10^{-12} | pico | p | 0.000000000001 |
10^{-9} | nano | n | 0.000000001 |
10^{-6} | micro | µ | 0.000001 |
10^{-3} | milli | m | 0.001 |
10^{3} | kilo | K | 1,000 |
10^{6} | mega | M | 1,000,000 |
10^{9} | giga | G | 1,000,000,000 |
10^{12} | tera | T | 1,000,000,000,000 |
Power | Preface | Symbol | Value |
2^{10} | kilo | K | 1,024 |
2^{20} | mega | M | 1,048,576 |
2^{30} | giga | G | 1,073,741,824 |
2^{40} | tera | T | 1,099,511,627,776 |
2^{50} | peta | P | |
2^{60} | exa | E | |
2^{70} | zetta | Z | |
2^{80} | yotta | Y |