hexadecimal converting back into decimal

To begin with, FFFF does not represent 2^16, but rather 2^16 – 1 (it would not be possible for any power of two to be an odd number).

Much like the decimal digits represent quantities of increasing powers of 10, hex digits represent quantities of increasing powers of 16 (in each case, the number whose powers we are dealing in is called the base of the system). Let’s break down and reconstruct decimal 65535:

6  5  5  3  5           /--> input is decimal: increasing powers of 10
|  |  |  |  |           |
|  |  |  |  \---> 5 * 10^0 = 5 * 1      =       5
|  |  |  \------> 3 * 10^1 = 3 * 10     =      30
|  |  \---------> 5 * 10^2 = 5 * 100    =     500
|  \------------> 5 * 10^3 = 5 * 1000   =    5000
\---------------> 6 * 10^4 = 6 * 10000  =   60000
                                          =======
                                            65535

The same with hex FFFF:

F  F  F  F               /--> input is hex: increasing powers of 16
|  |  |  |               |
|  |  |  \------> 15 * 16^0 = 15 * 1     =      15
|  |  \---------> 15 * 16^1 = 15 * 16    =     240
|  \------------> 15 * 16^2 = 15 * 256   =    3840
\---------------> 15 * 16^3 = 15 * 4096  =   61440
                                           =======
                                             65535

Leave a Comment