In the Hexadecimal number often shortened “hex”, is a number system which is made up of 16 symbols it means the base of this number system is 16.
The standard number system is called decimal number system; it uses 10 symbols for representation and the 10 symbols are 0,1,2,3,4,5,6,7,8,9. That means in decimal number system the base is 10. Using this number system we can’t represent values greater than 9. In hexadecimal number system letters taken from English alphabet, specifically A, B, C, D, E and F. Hexadecimal “A” represent the decimal number 10, and hexadecimal “ F” is equal to the decimal number 15.
Humans mostly use decimal number probably because of having ten fingers on their hand. But computer however have only on and off, called a binary digit. A binary number is just combination of 0s and 1s.
Hexadecimal number is mostly similar to the octal number system. This number system uses four-bit binary coding. It means each digit in hexadecimal number is the same as four digit binary number.
In the decimal number system, the first digit is the one’s place, the next digit to the left of first digit is the ten’s place, the next is the hundred’s place, etc. But in hexadecimal number system, each digit can be 16 values, not 10. So we can say the digits have the one’s place, the sixteen’s place, and the next one is the 256’s place. So 1hexadecimal = 1 decimal, 10hexadecimal = 16 decimal, and 100hexadecimal = 256 in decimal.
|100||1 0000 0000||400||256|
|3E8||11 1110 1000||1750||1000|
|1000||1 0000 0000 0000||10000||4096|
|FACE||1111 1010 1100 1110||175316||64206|
Hexadecimal to decimal conversion
There are two common ways to convert a number from hexadecimal numbers to decimal, there are two common ways.
The first approach is more ordinarily done when it is manually conversion:
- At first have to use the decimal value for each hexadecimal digit. It is the same for the number 0 to 9, but the values of A, B, C, D, E, F are 10, 11, 12, 13, 14, 15 respectively.
- Keep a sum of the products changed at each step below.
- Start with the least significant hexadecimal digit, digit on the right end. In a sum this will be the first item. This item will be the first item in a sum.
- Take the second-least significant digit, next to the digit on the right end. Multiply the decimal number digit by 16. Add the number to the sum.
- Do the same for the third-least vital digit, but multiply it by 162 (that is, 16 squared, or 256). Add it to the sum.
- Continue for each digit, adding each place by another power of 16. (4096, 65536, etc.)
|Value||65536 (164)||4096 (163)||256 (162)||16(161)||1 (160)|
In the time converting a number in software the next method is more commonly done. It does not require to know how many numbers has before when it starts, and it never multiplies by more than 16, but it looks longer on paper.
- At first have to use the decimal value for each hexadecimal digit. It is the same for the number 0 to 9, but the values of A, B, C, D, E,F are 10, 11, 12, 13, 14, 15 respectively
- Keep a sum of the numbers changed at each step below.
- Start among the various important digit (the digit on the far left). This is the first item in the sum.
- If there is another digit, multiply the sum by 16 and then add the decimal value of the next digit.
- Repeat the high step until there are no more digits.
Example: 5F hexadecimal to decimal, method 1
(5F)16 = (5 x 16) + (15 x 1)
= 80 + 15
Example: 5F hexadecimal to decimal, method 2
Sum= (5 x 16) + 15
= 80 + 15
Binary to Hexadecimal conversion
There are some steps for converting one binary number system to hexadecimal number system:-
- At first we have to underline each pair of the digits from right side to left. If any bit is left in the left side of the digit this will be the last set of pair.
- After that convert the each 4 digit set in to equivalent hexadecimal number.
- Then rewrite the digit which we get after the conversion.
Example: Convert (1010010100)2 to equivalent hexadecimal number.
0010 1000 0100
2 8 4
Advantages and Disadvantages
The major advantage of using Hexadecimal numbers is that we can store more numbers using less memory. Hexadecimal number system is also used to representing the Computer memory addresses. In hexadecimal form inputs and outputs are easier to handle. In data science field, artificial intelligence and machine learning the advantage is wide.
The major disadvantage is that it is not easy to read and write for people, and it is difficult to perform operations like multiplications, divisions using this number system.