The Numeric Systems: Conversion from Hexadecimal to Decimal |
A byte is made of 8 bits. This means that the highest hexadecimal value you can represent with a byte is 0xFF and the highest decimal value is 255. To convert a hexadecimal number to decimal, multiply each hexadecimal digit to its 16 base value. Starting on the left side, which is the low order bit, use the following table:
Consider a hexadecimal byte represented with 0x24, to convert it to decimal, you would use: = (2 * 16) + (4 * 1) = 32 + 4 = 36 Therefore, the decimal equivalent of 0x24 is 36 Consider another hexadecimal number as 0x5D. To convert it to decimal, you would write: 5 * 161 + D * 160. If you look at the table of numeric conversions,
Table of numeric conversions
you would see that the decimal value of hexadecimal D is 13. Therefore, the conversion would be performed as follows: = 5 * 161 + 13 * 160 = (5 * 16) + (13 * 1) = 80 + 13 = 93 Therefore, hexadecimal 0x5D = decimal 93
To convert a hexadecimal number to decimal, multiply each digit of the hexadecimal number to its 16-base equivalent. Starting from the
Consider a hexadecimal number such as 0x80329. To convert it to decimal, you would write: = (8 * 65536) + (0 * 4096) + (3 * 256) + (2 * 16) + (9 * 1) = 524288 + 0 + 768 + 32 + 9 = 525097 = (11 * 1048576 ) + (14 * 65536) + (4 * 4096) + (5 * 256) + (10 * 16) + (6 * 1) = 11534336 + 917504 + 16384 + 1280 + 160 + 6 = 12469670 = 12,469,670
|
|
Previous | Copyright © 2003-2009, FunctionX | Next |
|