Base 118


 * base 118

Base 118 and decimal
To convert a number from hexadecimal to decimal, there are two common ways.

The first method is more commonly done when converting it manually:


 * 1) Use the decimal value for each hexadecimal digit.  For 0-9, it is the same, but A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15.
 * 2) Keep a sum of the numbers converted at each step below.
 * 3) Start with the least significant hexadecimal digit. That is the digit on the right end. This will be the first item in a sum.
 * 4) Take the second-least significant digit. That is next to the digit on the right end. Multiply the decimal value of the digit by 16. Add this to the sum.
 * 5) Do the same for the third-least significant digit, but multiply it by 162 (that is, 16 squared, or 256). Add it to the sum.
 * 6) Continue for each digit, multiplying each place by another power of 16.  (4096, 65536, etc.)

The next method is more commonly done when converting a number in software. It doesn't need to know how many digits the number has before it starts, and it never multiplies by more than 16, but it looks longer on paper.


 * 1) Use the decimal value for each hexadecimal digit.  For 0-9, it is the same, but A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15.
 * 2) Keep a sum of the numbers converted at each step below.
 * 3) Start with the most significant digit (the digit on the far left).  This is the first item in the sum.
 * 4) If another digit exists, multiply the sum by 16 and add the decimal value of the next digit.
 * 5) Repeat the above step until there are no more digits.

Example: 5Fh and 3425h to decimal, method 1

Example: 5Fh and 3425h to decimal, method 2