Theoretical Foundations of Positional Numeral Systems & Radix

In discrete mathematics and computer engineering, a positional numeral system represents any real integer using an ordered sequence of numeric glyphs whose values depend upon their position relative to the radix point. The fundamental parameter defining any positional system is its base (or radix, \(b\)), an integer greater than 1 indicating the count of unique symbol digits available:

$$N = \sum_{i=0}^{n-1} d_i \cdot b^i = d_{n-1} b^{n-1} + d_{n-2} b^{n-2} + \dots + d_1 b^1 + d_0 b^0$$

Where \(d_i \in \{0, 1, \dots, b-1\}\) represents the digit at position \(i\).

Four primary bases form the operational architecture of digital electronics and software engineering:

  1. Decimal (Base 10): The human standard numbering system utilizing digits \(\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9\}\), likely derived from counting on ten human fingers.
  2. Binary (Base 2): The fundamental machine language of all silicon microprocessors, using only two states \(\{0, 1\}\) representing physical transistor conduction (cutoff vs saturation) or memory capacitor charge.
  3. Hexadecimal (Base 16): A compact human-readable representation using digits \(\{0\text{--}9\}\) and letters \(\{\text{A}, \text{B}, \text{C}, \text{D}, \text{E}, \text{F}\}\) (representing 10 through 15). Because \(16 = 2^4\), every single hexadecimal character corresponds exactly to a 4-bit binary nibble.
  4. Octal (Base 8): Using digits \(\{0, 1, 2, 3, 4, 5, 6, 7\}\). Because \(8 = 2^3\), each octal digit corresponds exactly to 3 binary bits, universally preserved in Linux file permission modes (e.g., chmod 777).

Exact Mathematical Conversion Algorithms

Transforming numbers between arbitrary bases requires two systematic analytical algorithms: positional expansion to evaluate arbitrary bases into decimal, and successive integer division with remainder extraction to convert decimal into any destination radix.

Core Radix Algorithms

1. Arbitrary Base to Decimal (Base 10 Evaluation):

$$N_{10} = d_{k-1} b^{k-1} + d_{k-2} b^{k-2} + \dots + d_1 b^1 + d_0 b^0$$

$$\text{Example: } \text{3E8}_{16} = (3 \times 16^2) + (14 \times 16^1) + (8 \times 16^0) = 768 + 224 + 8 = 1,000_{10}$$

2. Decimal to Destination Base (Successive Division Algorithm):

Divide the decimal integer repeatedly by target base \(b\); the remainders read in reverse chronological order formulate the destination representation.

$$\text{Example converting } 29_{10} \text{ to binary:}$$

$$29 \div 2 = 14 \text{ R } 1 \quad (\text{LSB})$$

$$14 \div 2 = 7 \text{ R } 0$$

$$7 \div 2 = 3 \text{ R } 1$$

$$3 \div 2 = 1 \text{ R } 1$$

$$1 \div 2 = 0 \text{ R } 1 \quad (\text{MSB}) \implies \mathbf{11101_2}$$

Hexadecimal-Binary Grouping & Two's Complement Encoding

A major advantage of power-of-two number bases is that conversion between binary, octal, and hexadecimal does not require arithmetic division; it is performed by simple bit-grouping inspection:

  • Binary to Hexadecimal: Group binary bits into clusters of 4 starting from the right (least significant bit): $$\text{Binary: } \underbrace{1101}_{\text{D}} \quad \underbrace{1011}_{\text{B}} \quad \underbrace{0000}_{0} \quad \underbrace{1111}_{\text{F}} \implies \mathbf{\text{0xDB0F}}$$
  • Binary to Octal: Group bits into clusters of 3 starting from the right: $$\text{Binary: } \underbrace{001}_{1} \quad \underbrace{101}_{5} \quad \underbrace{011}_{3} \implies \mathbf{153_8}$$

For signed integer representation, digital microprocessors utilize Two's Complement Arithmetic. In an \(n\)-bit two's complement system:

$$\text{Range: } -2^{n-1} \le X \le 2^{n-1} - 1$$

For standard 8-bit bytes, the range spans \(-128\) to \(+127\). The most significant bit (MSB) acts as the sign flag: if the MSB is 0, the number is positive; if the MSB is 1, the number is negative. To compute the magnitude of a negative number:

$$-X = \sim X + 1$$

For example, \(11111111_2\) represents \(255\) in an unsigned 8-bit integer, but in signed two's complement it represents \(-1\).

Comprehensive 4-Bit Radix Truth Table (0 to 15)

The reference table below illustrates the exact equivalence across decimal, 4-bit binary, octal, hexadecimal, and standard ASCII control values:

Decimal (Base 10) Binary (Base 2) Octal (Base 8) Hexadecimal (Base 16) Signed 4-Bit Two's Comp Bitwise Meaning / Logic
0 0000 00 0x0 0 All bits cleared (NULL / Zero)
1 0001 01 0x1 +1 Least Significant Bit (LSB) set
2 0010 02 0x2 +2 Bit 1 set (2ยน)
3 0011 03 0x3 +3 Bits 0 and 1 set
4 0100 04 0x4 +4 Bit 2 set (2ยฒ)
5 0101 05 0x5 +5 Bits 0 and 2 set
6 0110 06 0x6 +6 Bits 1 and 2 set
7 0111 07 0x7 +7 (Max signed 4-bit) Lower 3 bits set
8 1000 10 0x8 -8 (Min signed 4-bit) Bit 3 set (Sign bit in 4-bit)
9 1001 11 0x9 -7 Decimal 9 representation
10 1010 12 0xA -6 Alternating bit pattern (Nibble)
11 1011 13 0xB -5 Hexadecimal 'B'
12 1100 14 0xC -4 Upper 2 bits of nibble set
13 1101 15 0xD -3 Hexadecimal 'D'
14 1110 16 0xE -2 Hexadecimal 'E'
15 1111 17 0xF -1 Full nibble saturation (All 1s)

Worked Computer Science Case Study: Memory Dump Register Decoding

Systems Engineering Scenario: Debugging a Hexadecimal Machine Crash Dump

An embedded firmware developer is inspecting an ARM Cortex-M4 microcontroller hard fault dump. The crash log indicates that processor register R0 contained the 32-bit hexadecimal word 0xFFFFA4C2.

The systems engineer must determine:

  1. The exact raw binary representation in 32 bits (grouped into nibbles).
  2. The unsigned 32-bit decimal integer value.
  3. The signed 32-bit two's complement decimal value.
  4. The equivalent Octal representation for cross-checking with a Unix core dump log.

Step-by-Step Calculation:

1. Hexadecimal to Binary Translation (Direct Nibble Substitution):

F = 1111 | F = 1111 | F = 1111 | F = 1111 | A = 1010 | 4 = 0100 | C = 1100 | 2 = 0010

$$\mathbf{\text{Binary: } 1111\ 1111\ 1111\ 1111\ 1010\ 0100\ 1100\ 0010_2}$$

2. Unsigned 32-Bit Decimal Value:

$$N_{\text{unsigned}} = (\text{0xFFFFA4C2})_{16} = 4,294,943,938_{10}$$

3. Signed 32-Bit Two's Complement Value:

Because the MSB is 1 (the first hex digit is F = 1111), the number is negative.

$$\text{Invert bits: } \sim(1111\ 1111\ 1111\ 1111\ 1010\ 0100\ 1100\ 0010) = 0000\ 0000\ 0000\ 0000\ 0101\ 1011\ 0011\ 1101$$

In hexadecimal, \(\sim \text{0xFFFFA4C2} = \text{0x00005B3D}\).

$$\text{Add 1: } \text{0x00005B3D} + 1 = \text{0x00005B3E}$$

Evaluate magnitude in decimal:

$$(5 \times 16^3) + (11 \times 16^2) + (3 \times 16^1) + (14 \times 16^0) = (5 \times 4096) + (11 \times 256) + 48 + 14 = 20,480 + 2,816 + 62 = 23,358$$

$$\mathbf{\text{Signed Decimal Value: } -23,358_{10}}$$

4. Convert to Octal (Group by 3 bits from right):

$$\text{Bits: } 011\ 111\ 111\ 111\ 111\ 111\ 101\ 001\ 001\ 100\ 001\ 0$$

$$\mathbf{\text{Octal: } 37777722302_8}$$

Debug Conclusion: Register R0 was holding a signed temperature sensor offset of -23,358 counts, which underflowed an unsigned buffer pointer and caused the processor hard fault exception.

Frequently Asked Questions Regarding Number Bases

What are Endianness and Byte Order (Big-Endian vs. Little-Endian)?

Endianness defines the sequential memory address order in which multi-byte words are stored in RAM. In Big-Endian architectures (network TCP/IP protocol, Motorola 68k), the most significant byte (MSB) is stored at the lowest memory address. In Little-Endian architectures (x86, x86-64, modern ARM), the least significant byte (LSB) is stored first at the lowest address. For example, 32-bit hex word 0x12345678 is stored in Little-Endian memory as 78 56 34 12.

What is Base 64 encoding and why is it used in web development?

Base 64 uses 64 printable ASCII characters (A-Z, a-z, 0-9, +, /) to represent arbitrary binary data. Because early email systems (SMTP) and HTTP transmission channels were designed strictly for 7-bit ASCII text, sending raw binary files (images, PDF attachments, cryptographic keys) caused corrupted byte transmission. Base 64 splits binary bytes into 6-bit chunks (\(2^6 = 64\)) and maps each to safe printable ASCII characters, expanding file size by approximately 33%.

How does floating-point decimal conversion work in IEEE 754?

Computers store decimal fractions (such as 0.1) using the IEEE 754 floating-point standard: \(V = (-1)^s \times (1 + \text{mantissa}) \times 2^{\text{exponent} - \text{bias}}\). Because fractions like \(0.1_{10}\) result in an infinitely repeating binary fraction (\(0.0001100110011\dots_2\)), binary computers cannot store 0.1 exactly, leading to small roundoff anomalies like 0.1 + 0.2 === 0.30000000000000004 in languages like JavaScript and Python.

Can a number base be higher than 36?

Yes. Base 36 uses the ten numeric digits (0-9) and twenty-six Latin letters (A-Z). Systems with higher bases, like Base 58 (used in Bitcoin addresses to eliminate easily confused characters like 0, O, I, and l) and Base 64, use custom symbol tables that include both uppercase and lowercase distinctions and punctuation symbols.