Computer Number Systems

Fundamentals of Number Systems

  • Definition: A mathematical notation for representing quantities using a consistent set of symbols (digits) and rules.

  • Positional System: The value of each digit depends on both the digit itself and its position (place) within the number. Each position corresponds to a power of the system's Base (Radix).

  • Non-Positional System: Each symbol carries a fixed absolute value regardless of its position. Total value is determined by adding the symbol values.

  • Bit: A single binary digit (00 or 11), which is the fundamental unit of storage in digital computers.

Non-Positional Systems and Roman Numerals

  • General Characteristics: No concept of zero as a placeholder; extremely cumbersome for arithmetic and computation.

  • Roman Numerals Symbols: I=1I = 1, V=5V = 5, X=10X = 10, L=50L = 50, C=100C = 100, D=500D = 500, M=1000M = 1000.

  • Subtractive Notation: Smaller values placed before larger values are subtracted (e.g., IV=4IV = 4, XL=40XL = 40, CD=400CD = 400, CM=900CM = 900).

  • Limitations: Large numbers are unwieldy (e.g., 3999=MMMCMXCIX3999 = MMMCMXCIX) and fractions are impossible to represent easily.

The Positional Formula

  • General Expansion: Value=dn×rn+dn1×rn1++d1×r1+d0×r0\text{Value} = d_n \times r^n + d_{n-1} \times r^{n-1} + \dots + d_1 \times r^1 + d_0 \times r^0

  • Fractional Expansion: +d1×r1+d2×r2+\dots + d_{-1} \times r^{-1} + d_{-2} \times r^{-2} + \dots

  • Variables: rr represents the base (radix) and dd represents the digit at a specific position.

Computer Number Bases

  • Decimal (Base 10): Uses digits 00-99. It serves as the universal reference point for human-computer interaction.

  • Binary (Base 2): Fundamental computer language representing high (11) and low (00) voltage states.

  • Octal (Base 8): Uses digits 00-77. Historically used as shorthand in Unix/Linux systems. 1 octal digit=3 binary bits1\text{ octal digit} = 3\text{ binary bits}.

  • Hexadecimal (Base 16): Uses digits 00-99 and letters AA-FF (A=10,B=11,C=12,D=13,E=14,F=15A=10, B=11, C=12, D=13, E=14, F=15). Used for memory addresses, color codes (#FF8C00\#FF8C00), and MAC addresses. 1 hex digit=4 bits (a nibble)1\text{ hex digit} = 4\text{ bits (a nibble)}.

Conversion Methodologies

  • To Decimal: Multiply each digit by its positional weight (baseposition\text{base}^{\text{position}}) and sum the results.

  • Decimal to Integer: Successive division by the target base; read remainders from BOTTOM to TOP.

  • Decimal to Fraction: Successive multiplication by the target base; read integer carries from TOP to BOTTOM.

  • Binary Shortcuts:

    • To Octal: Group bits in threes from the right.

    • To Hex: Group bits in fours from the right.

  • Key Limits:

    • 1byte=8bits1\,\text{byte} = 8\,\text{bits}. Max value: 111111112=FF16=3778=2551011111111_2 = FF_{16} = 377_8 = 255_{10}.

    • 2bytes=16bits2\,\text{bytes} = 16\,\text{bits}. Max value: FFFF16=6553510FFFF_{16} = 65535_{10}.

Questions & Discussion

  • Q: Convert Roman Numeral MCMXCIVMCMXCIV to Decimal.

  • A: 1000+(1000100)+(10010)+(51)=1994101000 + (1000 - 100) + (100 - 10) + (5 - 1) = 1994_{10}.

  • Q: What is the binary equivalent of 20010200_{10}?

  • A: Successive division yields 11001000211001000_2.

  • Q: Convert 3F8163F8_{16} to decimal.

  • A: (3×256)+(15×16)+(8×1)=101610(3 \times 256) + (15 \times 16) + (8 \times 1) = 1016_{10}.

  • Q: What is the octal equivalent of binary 10110111210110111_2?

  • A: Grouped as 010110111=267010|110|111 = 2|6|7, resulting in 2678267_8.

  • Q: Convert the pixel color #FF8C00\#FF8C00 to decimal components.

  • A: Red: FF=25510FF = 255_{10}; Green: 8C=140108C = 140_{10}; Blue: 00=01000 = 0_{10}.