1. Introduction to Positional Number Systems
In digital computing, numerical values are expressed using positional number systems, where the quantitative weight of every digit is determined by its face value multiplied by an integral power of the base (or radix $r$):
\(N = \sum_{i=-m}^{n-1} d_i \cdot r^i = d_{n-1} r^{n-1} + \dots + d_1 r^1 + d_0 r^0 + d_{-1} r^{-1} + \dots + d_{-m} r^{-m}\)
where $r$ is the radix, $d_i$ are valid digits in the range $0 \le d_i \le r-1$, $n$ is the number of integer digits, and $m$ is the number of fractional digits.
2. The Four Primary Computing Number Systems
| Number System | Radix ($r$) | Allowed Symbols / Digits | Primary Computing Application |
|---|---|---|---|
| Binary | $2$ | $0, 1$ | Machine-level logic states (transistor ON/OFF, low/high voltage). |
| Octal | $8$ | $0, 1, 2, 3, 4, 5, 6, 7$ | Compact shorthand representation (1 octal digit = 3 binary bits). |
| Decimal | $10$ | $0, 1, 2, 3, 4, 5, 6, 7, 8, 9$ | Standard human numerical computation. |
| Hexadecimal | $16$ | $0\text{--}9$ and $\text{A}(10), \text{B}(11), \text{C}(12), \text{D}(13), \text{E}(14), \text{F}(15)$ | Memory addressing, color codes (#RRGGBB), bytecode display. |
3. Inter-Base Number Conversions
A. Decimal to Binary / Octal / Hexadecimal
Use the Successive Division Method for the integer portion and the Successive Multiplication Method for the fractional portion:
- Integer Part: Repeatedly divide the decimal integer by target radix $r$, noting down the remainder at each step. Read remainders from bottom to top (Last Remainder is Most Significant Bit/MSB).
- Fractional Part: Repeatedly multiply the decimal fraction by radix $r$. The integer carry is collected from top to bottom (First Carry is MSB).
$53 \div 2 = 26 \text{ remainder } \mathbf{1}$ (LSB)
$26 \div 2 = 13 \text{ remainder } \mathbf{0}$
$13 \div 2 = 6 \text{ remainder } \mathbf{1}$
$6 \div 2 = 3 \text{ remainder } \mathbf{0}$
$3 \div 2 = 1 \text{ remainder } \mathbf{1}$
$1 \div 2 = 0 \text{ remainder } \mathbf{1}$ (MSB)
Result: $(53)_{10} = (\mathbf{110101})_2$
B. Binary to Octal and Hexadecimal Grouping
- Binary to Octal: Partition binary digits into groups of 3 bits starting from the binary point outwards (pad with leading/trailing zeros if necessary). Replace each 3-bit group with its single octal digit.
Example: $(110101)_2 = (110)(101)_2 = (\mathbf{65})_8$ - Binary to Hexadecimal: Partition binary digits into groups of 4 bits from the binary point. Replace each 4-bit nibble with its hexadecimal symbol.
Example: $(0011\,0101)_2 = (\mathbf{35})_{16}$
4. 1's and 2's Complement Representation & Subtraction
Digital hardware circuits perform subtraction using addition hardware via complement representation:
1's Complement:
Obtained by inverting every bit of the binary word ($0 \to 1$ and $1 \to 0$).
2's Complement:
Obtained by adding $1$ to the 1's complement representation:
\(\text{2's Complement} = \text{1's Complement} + 1\)
- Take the 2's complement of the subtrahend $N$.
- Add this 2's complement value to the minuend $M$.
- If a carry is generated at MSB: Discard the end-around carry. The resulting sum is positive.
- If no carry is generated: The result is negative and in 2's complement form. Take 2's complement of the sum and prefix a minus sign.
5. Digital Alphanumeric & Binary Codes
- BCD (Binary Coded Decimal / 8421 Code): Encodes each individual decimal digit ($0\text{--}9$) into an independent 4-bit binary nibble (e.g. $85_{10} = 1000\,0101_{\text{BCD}}$).
- Excess-3 Code: An unweighted self-complementary code derived by adding $(0011)_2$ (decimal 3) to each BCD digit.
- Gray Code (Reflected Binary Code): A unit-distance code where two successive numerical values differ by only a single bit, preventing race conditions and mechanical encoder errors.
- ASCII (American Standard Code for Information Interchange): 7-bit character code standardizing 128 characters (control symbols, uppercase/lowercase alphabets, punctuation, digits).
- Unicode (UTF-8): Modern variable-length (1 to 4 bytes) encoding standard encompassing every character from all written languages and emoji symbols worldwide.