Conslabs
Number Systems & Digital Representation
beginnerJanuary 12, 2025 · 2 min read

Positional Number Systems

How positional notation works across binary, octal, decimal, and hexadecimal, and how to convert between them.

Every value a digital system stores or moves is ultimately a sequence of bits. Before any of digital logic, instruction sets, or firmware makes sense, you need a solid mental model of how those bits represent numbers.

Positional notation

A number system is just a convention for assigning weight to digit positions. In base b, the digit at position i (counting from zero on the right) contributes d_i * b^i to the total value.

SystemBaseDigitsExampleDecimal value
Binary20–1101111
Octal80–71311
Decimal100–91111
Hexadecimal160–9, A–FB11

Hexadecimal is popular in engineering because each hex digit maps exactly to four bits (a nibble), making it a compact, lossless shorthand for binary — far easier to read than a 32-bit string of 1s and 0s.

Converting between bases

To convert decimal to binary, repeatedly divide by 2 and read the remainders in reverse:

75 / 2 = 37 remainder 1
37 / 2 = 18 remainder 1
18 / 2 = 9  remainder 0
9  / 2 = 4  remainder 1
4  / 2 = 2  remainder 0
2  / 2 = 1  remainder 0
1  / 2 = 0  remainder 1
 
75 (decimal) = 1001011 (binary)

Going from binary to hexadecimal is just grouping bits into nibbles from the right:

0100 1011  ->  4B (hex)

Why this matters in practice

  • Memory addressing is hexadecimal because it compresses 32 or 64-bit addresses into a readable form.
  • Bit masks and flags (common in register configuration on microcontrollers) are usually written in hex or binary literals (0x40, 0b01000000) precisely so the bit positions stay legible.

Positional notation only covers non-negative values. The next sub-lesson, Two's Complement & Signed Arithmetic, covers how negative numbers and overflow actually work at the bit level.