Numbers are written as numberbase. example: 1010102 is 101010 base 2
The largest possible value a digit can be is "base - 1". examples: 22223, 999910, FFFF16
When a digit is worth more than "base-1" then the difference carries over to the next decimal. example: 22223 + 13 = 10000
If the digit is worth more than 9, then alphabetical characters are used to substitute. examples: A=10, B=11, C=12...
The digit’s value is determined by the base to the power of the position.
120.12 = (1*22) + (2*21) + (0*20) + (1*2-1)
120.110 = (1*102) + (2*101) + (0*100) + (1*2-1)
120.1a = (1*a2) + (2*a1) + (0*a0) + (1*a-1)
Alternative Solution (Horner Rewrite)
A table is the most effective way to organize a Horner Rewrite.
It should have 3 rows and the number of columns should equal the number of digits in the number being converted.
- The first line will be the number you are converting to base 10.
- An item in the third row is the sum of the two items above it.
- An item in the second row is the number in the third row of the previous column * the base of the number you are converting from.
Example: Convert 10101012 to base 10
Result: 10101012 = 8510
Convert From Base 10
1. Take the number you are converting and and divide by the target base.
2. Record the result and the remainder. The remainder is the last digit of the converted number.
2. Continue to divide the result by the target base and write the remainder down before the previous remainder.
When the result is finally 0, all the remainders you wrote down will give you the new number
Example: Convert 1320710 to base 16 Result: 1320710 = 339716