Understand the semantics of the decimal and hexadecimal number systems before converting numbers from decimal to hexadecimal. The base of a decimal number system, also known as a radix, is ten. As a result, it has ten symbols, which are the numerals 0 through 9, i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. A hexadecimal number system’s base, or radix, is 16. It employs 16 symbols since it is a base-16 numeric system. Ten decimal digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) and the first six letters of the English alphabet (A, B, C, D, E, F) are among them.
These letters, on the other hand, are employed to depict the numbers 10, 11, 12, 13, 14, and 15 in a single figure. We study how to convert a decimal number into its equal hexadecimal number system, or how to convert a base 10 number to a base 16 number, in decimal to hex conversion.
Decimal to Hexadecimal Conversion
It is fairly simple to convert decimal numbers to hexadecimal numbers. With the aid of a conversion table, this can be accomplished. If one memorizes this table, converting a decimal number to a hexadecimal number is simple. There is a hexadecimal equivalent for each decimal number from 1 to 15. However, if the decimal value is greater than 15, how do you convert it? Then we’ll have to go through a different process.
If a number is greater than 15, the equivalent hexadecimal number is obtained by dividing the decimal number by 16 and considering the residue. Here are the following steps for conversion.
How do I convert a decimal number to a hexadecimal number?
To convert decimal to hexadecimal, use the instructions below to perform some fundamental mathematical calculations.
Step 1: Take the remaining after dividing the supplied decimal number system value by 16.
Step 2: Take the quotient and divide it by 16. Rep this process till the quotient equals 0.
Step 3: In the remainders, use the characters A, B, C, D, E, and F in place of 10, 11, 12, 13, 14, 15, if needed.
Step 4: Arrange all of the values of the remainder using the reverse order pattern.
Step 5: The received number is the hexadecimal number that is required.
The formula for converting decimal to hexadecimal numbers is as follows:
Q16 = P10
P denotes a decimal number, and Q denotes a hexadecimal number.
With the use of a decimal point, you may convert decimal to hexadecimal.
We multiply the fractional part (decimal part) by 16 to convert any fractional number to a hexadecimal number. We multiply the fractional component by 16 until it equals 0 because the basis of a hexadecimal integer is 16. After each step, we must record the integer component of these products. The hexadecimal representation of the specified fractional integer is obtained as a result.
Conversion of 18.765625 to hexadecimal:
We’ll work on the integer and fractional parts separately.
Step 1: Let’s start with the integer component. After dividing 18 by 16, we obtain 18 16 = 1 as the quotient and 2 as the remainder.
Step 2: Now divide 1 by 16 to get the quotient, which is 16 1 = 0, and the remainder, which is 1.
Step 3: Now, by inverting the remainders, we can get the combined form, which is 12. This will be written as the hexadecimal value’s integer portion.
Step 4: Now we’ll concentrate on the fractional part of the equation, which is 0.765625.
Step 5: Multiply 0.765625 by 16, which gives 0.765625 16 = 12.25, in which the integer part will be noted. In the hexadecimal numeral system, 12 is written as C.
Step 6: We’ll now divide the fractional part of this product by 16 once more. We obtain 0.25 16 = 4 after multiplying the fractional component by 16.
Step 7: We now have 12.C4 after combining the integer and fractional parts of the hexadecimal form. As a result, in the hexadecimal number system, 18.765625 equals 12.C4. This suggests that ( 18.765625 )10 is equal to ( 12. C 4 )16.
Conclusion:
The repeated division and remainder procedure can be used to convert decimal to hexadecimal. Simply put, the decimal number is divided by the radix 16 many times. The remainders in between these divisions yield the hex equivalent in reverse order.