Number Systems
Data Representation
There are two methods for each direction. Method 1 goes through binary as a stepping stone and is foolproof; method 2 uses arithmetic directly and is faster once you are confident.
Denary to hex, Method 1: via binary
- Convert the denary number to an 8-bit value.
- Split the binary value into two (groups of 4 bits).
- Convert each nibble to its denary value (0 to 15).
- Write each value as a hex digit using the A to F table for 10 to 15.
Denary to hex, Method 2: divide by 16
- Divide the number by 16. The whole part is the first hex digit; the remainder is the second hex digit.
- Convert any value 10 to 15 to its hex letter (A to F).
Hex to denary, Method 1: via binary
- Convert each hex digit to a 4-bit binary nibble.
- Join the two nibbles into an 8-bit binary number.
- Convert the binary number to denary using place values.
Hex to denary, Method 2: multiply by 16
- Multiply the first hex digit by 16.
- Add the second hex digit to the result.
Common exam question
Converting denary to hexadecimal
Question: Convert one or more denary numbers to hexadecimal (1–3 marks).
Asked in 5 of the 17 papers. Use either method from this section, then check the number of digits: a value from 0 to 255 is at most two hex digits, and a single digit such as B is a complete answer for 11. Values of 10 to 15 must appear as their letters, so 27 is 1B, not 1 11.
A number from 256 to 4095 needs three hex digits, and the one paper that set one marked it out of two: one mark for two correct digits, two for all three in the right order. Divide by 16 twice, then write the last quotient followed by the remainders from last to first (428 → 26 remainder 12, 26 → 1 remainder 10, so 1AC), or go through binary and pad its nine bits to three nibbles.