Number system conversion
Binary number system is the most commonly used and decimal system is the most understandable while
hexadecimal system is somewhere between them. Therefore, it is very important to learn how to convert
numbers from one number system to another, i.e. how to turn series of zeros and units into values
understandable for us.
Binary to decimal number conversion
Digits in a binary number have different values depending on their position in that number. Additionally,
each position can contain either 1 or 0 and its value may be easily determined by its position from the right.
To make the conversion of a binary number to decimal it is necessary to multiply values with the
corresponding digits (0 or1) and add all the results. The magic of binary to decimal number conversion
works...You doubt? Look at the example:
110 = 1*2^2 + 1*2^1 + 0*2^0 = 6
It should be further noticed that for decimal numbers from 0 to 3 it is enough to have two binary digits. For
greater values, new binary digits must be added. Thus, for numbers from 0 to 7 it is enough to have three
digits, for numbers from 0 to 15- four digits etc. Simply speaking, the largest binary number consisting of n
digits is obtained when the base 2 is raised by n. The result should be afterwards subtracted by 1. For
example, if n=4:
2^4 - 1 = 16 - 1 = 15
Accordingly, using 4 binary digits it is possible to represent decimal numbers from 0 to 15, including these
two digits, which amounts to 16 different values in total.
Hexadecimal to decimal number conversion
In order to make conversion of a hexadecimal number to decimal, each
hexadecimal digit should be multiplied with the number 16 raised by it’s position
value. For example:
Hexadecimal to binary number conversion
It is not necessary to perform any calculation in order to convert hexadecimal
number to binary number system. Hexadecimal digits are simply replaced by the
appropriate four binary digits. Since the maximal hexadecimal digit is equivalent to decimal number 15, it
is needed to use four binary digits to represent one hexadecimal digit. For example:
Chia sẻ với bạn bè của bạn: |