Numbering Systems
Binary, octal and hexadecimal numbering systems; conversion between them and decimal; binary coded decimal and two's complement for signed values.
Numbering systems, summary notes
- A positional system gives each digit a weight of baseᵏ, counting k from 0 at the least-significant digit. Binary (base 2) weights are …16, 8, 4, 2, 1; octal is base 8; hexadecimal is base 16.
- Hexadecimal digits A, B, C, D, E, F represent decimal 10, 11, 12, 13, 14, 15, not 11-16.
- Binary converts to octal by grouping bits in THREES from the right, and to hexadecimal by grouping in FOURS from the right, padding the left-hand group with zeros.
- BCD (binary coded decimal) encodes each decimal digit as its own 4-bit group: 29 → 0010 1001. It is not the same as the plain binary value of 29 (1 1101). BCD wastes the codes 1010-1111 but makes decimal display driving trivial.
- Signed binary uses two's complement: invert every bit and add 1. The MSB is then the sign bit (1 = negative), and ordinary binary addition works for signed values with no special case.
- Octal is the natural shorthand for ARINC 429 labels; hexadecimal is the natural shorthand for memory addresses and byte data.
- ⚠ Exam trap: mis-grouping is the commonest error, octal groups in 3s, hexadecimal in 4s. Reading a hex answer as if it were BCD (or vice versa) is the second commonest.
- Positional value (base b)
- value = Σ (dₖ · bᵏ), k = 0 at the LSD
- Binary place values
- … 128 · 64 · 32 · 16 · 8 · 4 · 2 · 1
- Binary → octal
- group bits in 3s from the right
- Binary → hexadecimal
- group bits in 4s from the right
- Two's complement (n-bit)
- invert all bits, then add 1; MSB = sign
- Largest value in n bits
- 2ⁿ − 1 (unsigned)
Convert 1011 0110₂ to hexadecimal and to decimal.
Group in 4s: 1011 = B and 0110 = 6, so the value is B6₁₆. In decimal, add the place values where a 1 appears: 128 + 32 + 16 + 4 + 2 = 182₁₀.
Encode 45 in BCD, then represent −45 in 8-bit two's complement.
BCD takes each decimal digit separately: 4 → 0100 and 5 → 0101, giving 0100 0101. For two's complement, +45 = 0010 1101; invert to 1101 0010; add 1 to get 1101 0011. The leading 1 confirms a negative value.
Number-system converter
Numbering systems concept map
Numbering Systems
Numbering systems quiz
Numbering Systems, quiz
1. The binary number 1101 expressed in decimal is:
1311262. The decimal number 255 expressed in hexadecimal is:
FFF01003. The hexadecimal number A5 expressed in decimal is:
1651551054. The decimal number 27 expressed in binary is:
1101111101101115. The decimal number 47 expressed in binary coded decimal (BCD) is:
0100 01110010 11110100 11106. Convert 1101 0011₂ to hexadecimal.
D3C3B37. Hexadecimal F represents which decimal value?
1514168. In BCD, the decimal number 36 is encoded as:
0011 01100010 01000110 00119. The binary number 1011 equals which decimal value?
1113910. To convert binary to octal, the bits are grouped from the right in:
ThreesFoursTwos11. Convert 0011 1010₂ to decimal.
58566212. The two's complement of the 8-bit number 0010 1101 is:
1101 00111101 00100010 1110