2AF₁₆ → octal — number base conversion
exam standardroute through binary, not decimal
Answer
1257
Why this example is worth doing
Converting between two non-decimal bases is done by going through binary, not through decimal: expand each hex digit to four bits, then regroup those bits in threes for octal. It is faster and it cannot go wrong arithmetically, since neither step involves any addition. The page shows the intermediate bit string explicitly because the regrouping — from fours to threes, with the boundaries in different places — is the whole content of the exercise.
Try your own input in the Binary ⇄ decimal ⇄ hex ⇄ octal. Convert between any two bases, integers and fractions, with the positional working.
How the answer is reached
Base 16 to base 8
Convert 2AF from base 16 to base 8. The sign is carried across unchanged; only the magnitude is converted.
| digit | value | weight | weight (base 10) | digit x weight |
|---|---|---|---|---|
| 2 | 2 | 16^2 | 256 | 512 |
| A | 10 | 16^1 | 16 | 160 |
| F | 15 | 16^0 | 1 | 15 |
| total | 687 |
Integer part: divide by 8 and read the remainders bottom to top.
| n | divide by | quotient | remainder |
|---|---|---|---|
| 687 | 687 ÷ 8 | 85 | 7 |
| 85 | 85 ÷ 8 | 10 | 5 |
| 10 | 10 ÷ 8 | 1 | 2 |
| 1 | 1 ÷ 8 | 0 | 1 |
2AF (base 16)1257 (base 8)