Ancient civilizations invented different types of symbols to represent number and grouping. Many of them use decimal ( base-ten ) representation, probably because there are ten fingers on two hands. :)
Among all ancient civilizations, Chinese numeral system was the most sophisticated and advanced. Evidence of using decimal number was found in an inscription from the ancient time, which date back to at least the 2nd millennium BCE.
In additional to base 10 system, there are other numeral systems, such as base 60, which was also commonly used by ancient people for date time calculation. In modern time, computers use the binary numeral system for internal calculation. Hexadecimal and octal are the companion for the binary number as they are easy to use.
Reference:
Numerals from Ancient China
The Story of Mathematics
Decimal, also called the base-ten positional numeral system or denary, or Hinduâ€“Arabic numeral system, has 10 symbols ( 0123456789 ).
Number position and value
Number | 10 Thousands | Thousands | Hundreds | Tens | One |
---|---|---|---|---|---|
10 = | 1x10^{1} + | 0x10^{0} | |||
100 = | 1x10^{2} + | 0x10^{1} + | 0x10^{0} | ||
1234 = | 1x10^{3} + | 2x10^{2} + | 3x10^{1} + | 4x10^{0} | |
12345 = | 1x10^{4} + | 2x10^{3} + | 3x10^{2} + | 4x10^{1} + | 5x10^{0} |
From the above examples, we can observe that the value of each position represents a specific power of the base 10. The above concept is the key to understand the number value in different base notation, and convert them back to decimal value. We will discuss base x to base 10 conversion in next sections.
Convert base 10 to base 8
To fit a base 10 into a base 8 number, the resulting number will be "longer". We can use the successive division-remainder method to achieve the conversion. That is, we divide our target number continuously by 8, until we get all the remainders. On each division, we shift 1 position and the value of the resulting remainder increase by 8^{position-1}
Example, convert 83_{10} to base 8
8 83* Note: Read the remainder upward, the result is 123_{8}.
Think reversely, 123_{8} = 1x8^{2} + 2x8^{1} + 3x8^{0} = 83_{10}
Convert base 10 to base 16
To fit a base 10 into a base 16 number, the resulting number will be "shorter". We can use the successive division-remainder method to achieve the conversion. That is, we divide our target number continuously by 16, until we get all the remainders. On each division, we shift 1 position and the value of the resulting remainder increase by 16^{position-1}
Example, convert 83_{10} to base 16
16 83* Note: Read the remainder upward, the result is 53_{16}.
Think reversely, 53_{16} = 5x16^{1} + 3x16^{0} = 83_{10}
Convert base 10 to base 2
To fit a base 10 into a base 2 number, the resulting number will be "longer". We can use the successive division-remainder method to achieve the conversion. That is, we divide our target number continuously by 2, until we get all the remainders. On each division, we shift 1 position and the value of the resulting remainder increase by 2^{position-1}
Example, convert 83_{10} to base 2
2 83* Note: Read the remainder upward, the result is 1010011_{2}.
Think reversely, 1010011_{2} = 1x2^{6} + 0x2^{5} + 1x2^{4} + 0x2^{3} + 0x2^{2} + 1x2^{1} + 1x2^{0}= 83_{10}
Reference:
Decimal
Octal, also called base 8, has 8 symbols ( 01234567 ). Oct is a more human-friendly representation of the binary number, each oct digit represents 3 binary digits. Oct was commonly used with old computers which employed 12-bit, 24-bit or 36-bit words. Similar with the decimal number, the value of an octal digit is determined by the position of the symbol in the number.
Number position and value
Number | 8^{3} | 8^{2} | 8^{1} | 8^{0} |
---|---|---|---|---|
12_{8} = 10_{10} = | 1x8^{1} + | 2x8^{0} | ||
123_{8} = 83_{10} = | 1x8^{2} + | 2x8^{1} + | 3x8^{0} | |
1234_{8} = 668_{10} = | 1x8^{3} + | 2x8^{2} + | 3x8^{1} + | 4x8^{0} |
From the above examples, we can observe that the value of each position represents a specific power of the base 8. After adding all the values together, we get the value of the octal in base 10. That is how we convert a number from base 8 to base 10 :)
Convert base 8 to base 2
To convert a base 8 to binary, we can first convert it to a decimal number and then to the binary by the successive division-remainder method. However, this is the difficult way and it is not preferred. Consider Oct is actually a binary companion, and each oct represents 3 binary digits, binary conversion is actually very easy.
Octal Digit | Binary Value |
---|---|
0 | 000 |
1 | 001 |
2 | 010 |
3 | 011 |
4 | 100 |
5 | 101 |
6 | 110 |
7 | 111 |
Example, convert 123_{8} to base 2
1 = 001The digit value and position is an exact 1-to-1 match, so we only need to concatenate the all the binary digits together. The result is 001 010 011_{2} or 1010011_{2} ( preceding zero removed )
Convert base 2 to base 8
Similarly, just perform the operation in the reverse. First group binary digits into 3, then you can convert each group to an Oct digit. Finally, concatenate all the oct digits.Reference:
Octal
Hexadecimal, also called base 16 or hex, has 16 symbols ( 0123456789ABCDEF ). Hex is a more human-friendly representation of the binary number, each hex digit represents 4 binary digits, 2 hex digits represents 1 byte( 8 binary digits ).
Hex is used with almost all modern computers as it is most efficient and easy way to represent 1 byte. Similar with the decimal number, the value of a hex digit is determined by the position of the symbol in the number.
Number position and value
Number | 16^{3} | 16^{2} | 16^{1} | 16^{0} |
---|---|---|---|---|
12_{16} = 18_{10} = | 1x16^{1} + | 2x16^{0} | ||
123_{16} = 291_{10} = | 1x16^{2} + | 2x16^{1} + | 3x16^{0} | |
1234_{16} = 4660_{10} = | 1x16^{3} + | 2x16^{2} + | 3x16^{1} + | 4x16^{0} |
From the above examples, we can observe that the value of each position represents a specific power of the base 16. After adding all the values together, we get the value of the hex in base 10. That is how we convert a number from base 16 to base 10 :)
Convert base 16 to base 2
To convert a base 16 to binary, we can first convert it to a decimal number and then to the binary by the successive division-remainder method. However, this is the difficult way and it is not preferred. Consider hex is actually a binary companion, and each hex represents 4 binary digits, binary conversion is actually very easy.
Hex Digit | Decimal Value | Binary Value |
---|---|---|
0 | 0 | 0000 |
1 | 1 | 0001 |
2 | 2 | 0010 |
3 | 3 | 0011 |
4 | 4 | 0100 |
5 | 5 | 0101 |
6 | 6 | 0110 |
7 | 7 | 0111 |
8 | 8 | 1000 |
9 | 9 | 1001 |
A | 10 | 1010 |
B | 11 | 1011 |
C | 12 | 1100 |
D | 13 | 1101 |
E | 14 | 1110 |
F | 15 | 1111 |
Example, convert 53_{16} to base 2
5 = 0101The digit value and position is an exact 1-to-1 match, so we only need to concatenate the all the binary digits together. The result is 0101 0011_{2} or 1010011_{2} ( preceding zero removed )
Convert base 2 to base 16
Similarly, just perform the operation in the reverse. First group binary digits into 4, then you can convert each group to a hex digit. Finally, concatenate all the hex digits.Example, convert 1110111010_{16} to base 2
1110111010 -> 0011 1011 1010 -> 3BA_{16}Reference:
Hexadecimal
The modern binary number system was invented by Gottfried Leibniz in 1689 influenced by ancient Chinese literature. Binary number is a number expressed in the base-2 numeral system 0 and 1, used by almost all modern computer-based devices.
Some very early computers did not use binary for computation, for example, the ENIAC used decimal instead. However, due to the simplicity and reliability of binary logic design, almost all modern computers nowadays use binary coding system. Similar with decimal number, the value of a hex digit is determined by the position of the symbol in the number.
Number position and value
Number | 2^{3} | 2^{2} | 2^{1} | 2^{0} |
---|---|---|---|---|
10_{2} = 2_{10} = | 1x2^{1} + | 0x2^{0} | ||
100_{2} = 4_{10} = | 1x2^{2} + | 0x2^{1} + | 0x2^{0} | |
1010_{2} = 10_{10} = | 1x2^{3} + | 0x2^{2} + | 1x2^{1} + | 0x2^{0} |
From the above examples, we can observe that the value of each position represents a specific power of the base 2. After adding all the values together, we get the value of the binary in base 10. That is how we convert a number from base 2 to base 10 :)
Due to the special relationship with oct and hex, converting binary to oct or hex is very easy.
Convert base 2 to base 8
Example, convert 1110111010_{8} to base 2
1110111010 -> 001 110 111 010 -> 1672_{8}Convert base 2 to base 16
Example, convert 1110111010_{16} to base 2
1110111010 -> 0011 1011 1010 -> 3BA_{16}Reference:
Decimal
Â© dec2hex.com 2017-2024