Data Representation Fundamentals and Numeral Systems

Introduction to Digital Data Representation

  • Background of Digital Techniques: Digital methods have permeated numerous technological sectors, with automatic digital computers representing the most extensive application.

  • Definition of a Computer: A computer is defined as a hardware system designed to perform arithmetic operations, manipulate data, and make logical decisions.

  • Nature of Quantities: In science, business, and technology, physical quantities are constantly measured, recorded, and utilized. In digital systems, these quantities are represented using symbols known as digits.

  • Common Number Systems: Digital technology utilizes various number systems to represent digits, specifically:

    • Decimal system.

    • Binary system.

    • Octal system.

    • Hexadecimal system.

Numeral Systems Architecture

  • Definition: Numeral or numbering systems provide a mechanism for representing numbers through a finite set of distinct graphic symbols or signs.

  • Interchangeability: The same numerical value can be represented differently across various systems. For example, the decimal value 421042_{10} is equivalent to 52852_8 in the octal system and 2A162A_{16} in the hexadecimal system.

  • Major Categories of Number Systems:

    • Non-positional Number Systems: Historically based on additive approaches using fingers, stones, or sticks. A symbol carries a constant value regardless of its position within a sequence.

    • Positional Number Systems: Also known as place-value systems, where the placement of a digit relative to other symbols determines its actual weight or weight-value.

Non-Positional Numeral Systems

Roman Numeral System
  • Symbols and Decimal Values:

    • II = 11

    • VV = 55

    • XX = 1010

    • LL = 5050

    • CC = 100100

    • DD = 500500

    • MM = 10001000

  • Operational Rules:

    • Additive Rule: If two consecutive digits are ordered such that the first is greater than or equal to the second, their values are added (e.g., III=1+1+1=3III = 1+1+1=3; MD=1000+500=1500MD = 1000+500=1500; note: transcript says MD=2500MD=2500 as typo for MMDMMD).

    • Subtractive Rule: If digits are in increasing order of value, the smaller value is subtracted from the larger (e.g., IX=101=9IX = 10 - 1 = 9; MXL=1000+(5010)=1040MXL = 1000 + (50 - 10) = 1040; CM=1000100=900CM = 1000 - 100 = 900).

Greek Numeral System
  • Symbols and Decimal Values:

    • | = 11

    • Γ\Gamma = 55

    • Δ\Delta = 1010

    • HH = 100100

    • XX = 1,0001,000

    • MM = 10,00010,000

  • Methodology: Grouping is often centered around fives. Powers of 10 are represented by the first letter of the corresponding Greek word.

  • Examples:

    • ΓΔ=5×10=50\Gamma \Delta = 5 \times 10 = 50

    • ΓH=5×100=500\Gamma H = 5 \times 100 = 500

    • ΓX=5×1,000=5,000\Gamma X = 5 \times 1,000 = 5,000

    • ΓM=5×10,000=50,000\Gamma M = 5 \times 10,000 = 50,000

Positional Numeral Systems and Base (Radix)

  • Nature of Weighted Values: The value of a digit is its intrinsic value multiplied by a weight determined by its position.

    • Example using digit '5': In 135, it represents 5×1=55 \times 1 = 5. In 153, it represents 5×10=505 \times 10 = 50. In 531, it represents 5×100=5005 \times 100 = 500.

  • Definition of Base or Radix: The base (or radix) indicates the total number of distinct symbols used in that system.

    • Decimal: Base 10 (Symbols: 0,1,2,3,4,5,6,7,8,9{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}).

    • Binary: Base 2 (Symbols: 0,1{0, 1}).

    • Octal: Base 8 (Symbols: 0,1,2,3,4,5,6,7{0, 1, 2, 3, 4, 5, 6, 7}).

    • Hexadecimal: Base 16 (Symbols: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}).

  • Mathematical Representation of Positional Values:

    • For a number like 437.591437.591:

    • 4×102+3×101+7×100+5×101+9×102+1×1034 \times 10^2 + 3 \times 10^1 + 7 \times 10^0 + 5 \times 10^{-1} + 9 \times 10^{-2} + 1 \times 10^{-3}.

  • Fixed-Radix vs. Mixed-Radix: Digital systems typically stick to fixed-radix systems where the base is constant for all positions.

Digital Number Systems Characteristics

Decimal Number System (Base-10)
  • Evolution: Likely derived from humans having 10 fingers.

  • Nomenclature:

    • Most Significant Digit (MSD): The leftmost digit carrying the most weight.

    • Least Significant Digit (LSD): The rightmost digit carrying the least weight.

  • Example: 2512.19712512.1971 is decomposed as 2×103+5×102+1×101+2×100+1×101+9×102+7×103+1×1042 \times 10^3 + 5 \times 10^2 + 1 \times 10^1 + 2 \times 10^0 + 1 \times 10^{-1} + 9 \times 10^{-2} + 7 \times 10^{-3} + 1 \times 10^{-4}.

Binary Number System (Base-2)
  • Implementation: Hard to design circuits with 10 voltage levels; very easy to design circuits with two (ON/OFF, high/low voltage).

  • Terms:

    • Bit: Abbreviation for Binary Digit.

    • Most Significant Bit (MSB): Leftmost bit.

    • Least Significant Bit (LSB): Rightmost bit.

  • Positional Weights: Powers of 2 (e.g., 23,22,21,202^3, 2^2, 2^1, 2^0 for integers; 21,222^{-1}, 2^{-2} etc. for fractions).

  • Counting Pattern:

    • Units bit (LSB) alternates every count (0,1,0,1...0, 1, 0, 1...).

    • Second bit (212^1) alternates every 2 counts (0,0,1,1...0, 0, 1, 1...).

    • Third bit (222^2) alternates every 4 counts.

    • General rule: Alternates in groups of 2N12^{N-1}.

Octal Number System (Base-8)
  • Weights: Based on powers of 8.

  • Example: 3721.240683721.2406_8 converted to decimal is 2001.313964102001.313964_{10}.

Hexadecimal Number System (Base-16)
  • Symbols: 090-9 and letters AFA-F.

    • A=10A = 10, B=11B = 11, C=12C = 12, D=13D = 13, E=14E = 14, F=15F = 15.

  • Utility: Serves as a shorthand for representing large binary strings; every hex digit represents exactly 4 binary bits.

Number System Conversions

Decimal-to-Binary
  • Method 1: Powers of 2 Table: Subtract the largest possible power of 2 from the decimal number, record the bit, and repeat with the remainder.

    • Example: 431032(25)43_{10} \rightarrow 32 (2^5), remainder 118(23)11 \rightarrow 8 (2^3), remainder 32(21)3 \rightarrow 2 (2^1), remainder 11(20)1 \rightarrow 1 (2^0). Result: 1010112101011_2.

  • Method 2: Repeated Division: Successively divide the integer by 2; remainders recorded from bottom to top form the binary string.

  • Decimal Fractions to Binary: Successively multiply the fractional part by 2. Collect integers to the left of the decimal point from top to bottom.

    • Example: 0.37510×2=0.75(0)0.375_{10} \times 2 = 0.75 (0), 0.75×2=1.50(1)0.75 \times 2 = 1.50 (1), 0.50×2=1.00(1)0.50 \times 2 = 1.00 (1). Result: 0.01120.011_2.

Binary-to-Decimal
  • Method 1: Positional Weights: Sum the values of 2n2^n for every bit position containing a 1.

  • Method 2: Dibble-Dobble Method: Start with the leftmost bit, multiply by 2, add the next bit, and repeat until the binary point is reached.

Decimal-to-Octal / Hex
  • Integer: Use repeated division by the target radix (8 or 16).

  • Fractions: Use repeated multiplication by the target radix (8 or 16).

Octal/Hex Conversions
  • Octal to Binary: Replace each octal digit with its 3-bit binary equivalent (7811127_8 \rightarrow 111_2).

  • Binary to Octal: Group binary bits in threes starting from the binary point. Add leading or trailing zeros to complete groups.

  • Hex to Binary: Replace each hex digit with its 4-bit binary equivalent (F1611112F_{16} \rightarrow 1111_2).

  • Binary to Hex: Group binary bits in fours starting from the binary point.

Binary Representation of Integers

  • Storage standard: Integers are stored using a fixed number of bits (8, 16, 32, or 64).

  • Unsigned Integers: Represent 0 and positive values. Range for nn bits is 00 to 2n12^n - 1.

    • 8-bit range: 00 to 255255.

    • 16-bit range: 00 to 65,53565,535.

  • Signed Integers: Represent negative, zero, and positive values. Three main schemes:

Sign-Magnitude Representation
  • MSB: Used as sign bit (00 for positive, 11 for negative).

  • Magnitude: The remaining n1n-1 bits represent the absolute value.

  • Drawbacks:

    1. Two representations of zero (+0+0 as 0000000000000000 and 0-0 as 1000000010000000).

    2. Difficulty in processing arithmetic; positive and negative logic must be handled separately.

One's Complement Representation
  • Method: Positive numbers are standard binary. Negative numbers are found by inverting all bits of the positive equivalent (01,100 \rightarrow 1, 1 \rightarrow 0).

  • Drawbacks: Still contains two versions of zero (00000000 and 11111111).

Two's Complement Representation
  • Method: Add 1 to the 1's complement of the number.

  • Alternative Method: Copy bits from right to left up to and including the first 1; then invert all remaining bits.

  • Advantages:

    1. Only one unique representation for zero (00000000\dots00000000).

    2. Addition and subtraction use the same unified logic circuitry.

  • Storage: Modern computers use 2's complement for signed integers.

Floating-Point Representation (Real Numbers)

Fixed-Point Representation
  • Real numbers are split by a fixed number of bits for the integer part and the fractional part.

  • Example: A 32-bit system might use 24 bits for the integer and 8 for the fraction.

  • Limitation: Cannot represent very large or very small numbers efficiently.

Scientific (Exponential) Notation
  • Form: F×rEF \times r^E (FF = Mantissa/Fraction, rr = Radix, EE = Exponent).

  • Normalization: A number is normalized when there is exactly one non-zero digit before the radix point. In binary, this digit is always 1.

IEEE 754 Standard
  • Single Precision (32-bit):

    • 1 sign bit.

    • 8 exponent bits.

    • 23 mantissa bits.

  • Double Precision (64-bit):

    • 1 sign bit.

    • 11 exponent bits.

    • 52 mantissa bits.

  • Implicit Leading Bit: In the normalized mantissa, the leading '1' before the binary point is not stored to save space.

  • Excess/Biased Notation: Computers store exponents in biased form (e.g., Excess-127 for single precision) to allow easy sorting of floating-point numbers.

  • Trade-off: Increasing bits for the mantissa improves precision (accuracy), while increasing bits for the exponent increases the range of numbers.

Binary Arithmetic Operations

Binary Addition Rules
  • 0+0=00 + 0 = 0

  • 0+1=10 + 1 = 1

  • 1+0=11 + 0 = 1

  • 1+1=101 + 1 = 10 (00 with carry 11)

  • 1+1+1=111 + 1 + 1 = 11 (11 with carry 11)

Binary Subtraction Rules
  • 00=00 - 0 = 0

  • 10=11 - 0 = 1

  • 11=01 - 1 = 0

  • 101=110 - 1 = 1 (01=10 - 1 = 1 with a borrow of 11)

Multiplication and Division
  • Multiplication: Rules follow standard logic: 0×0=00 \times 0 = 0, 0×1=00 \times 1 = 0, 1×1=11 \times 1 = 1. Partial products are shifted and added.

  • Division: Follows same long-division format as decimal: 0÷1=00 \div 1 = 0, 1÷1=11 \div 1 = 1.

Complement Arithmetic
  • 1's Complement Addition: If a carry is generated out of the sign bit, it must be added to the LSB (End-Around Carry).

  • 2's Complement Addition: Standard addition including the sign bit. Any final carry generated out of the sign bit position is ignored.

  • Overflow Detection: In 2's complement, an overflow occurs if adding two numbers of the same sign produces a result with the opposite sign.

Alphanumeric Codes and Character Representation

ASCII
  • Full Name: American Standard Code for Information Interchange.

  • Detail: 7-bit code providing 128128 code groups. Used for standard keyboard characters and control functions like (RETURN)(RETURN) and (LINEFEED)(LINEFEED).

EBCDIC
  • Full Name: Extended Binary Coded Decimal Interchange Code.

  • Detail: 8-bit code (256 symbols). Primarily used in IBM mainframe systems.

ISCII
  • Full Name: Indian Standard Code for Information Interchange.

  • Detail: Adopted in 1991 by the Bureau of Indian Standards. 8-bit code (256256 characters) that retains ASCII and adds support for Devanagari, Bengali, Gujarati, Gurmukhi, Oriya, Telugu, Kannada, Malayalam, and Tamil.

  • Similar script structure allows for easy transliteration between Indian languages.

Unicode
  • Purpose: A universal standard providing a unique number for every character regardless of platform, program, or language.

  • Capacity:

    • Version 3.0: Represented 49,19449,194 characters.

    • Version 3.1: Represented 94,14094,140 characters.

  • Architecture: Usually 16-bit, representing up to 65,53665,536 characters in its basic plane. Based on ISCII-1988 for the Indian language block.

Questions & Discussion

  • Q: Convert 431043_{10} to binary using repeated division.

    • A: 43÷2=2143 \div 2 = 21 R 11 (LSB); 21÷2=1021 \div 2 = 10 R 11; 10÷2=510 \div 2 = 5 R 00; 5÷2=25 \div 2 = 2 R 11; 2÷2=12 \div 2 = 1 R 00; 1÷2=01 \div 2 = 0 R 11 (MSB). Result: 1010112101011_2.

  • Q: Decode ASCII hex values 48, 45, 4C, 50.

    • A: Using Table 1.10: 48H48 \rightarrow H, 45E45 \rightarrow E, 4CL4C \rightarrow L, 50P50 \rightarrow P. The word is "HELP".

  • Q: What is the benefit of Excess-notation?

    • A: It maintains the sorted order of bit patterns for both positive and negative numbers, which assists in computational sorting processes.

  • Q: Determine the 8-bit sign-magnitude for 23-23.

    • A: Binary 2323 is 1011110111. For an 8-bit sign-magnitude, MSB is 11 (for negative) followed by zeros for padding and the magnitude: 1001011110010111.