Comprehensive Study Guide: Number Systems, Base Conversions, Signed Arithmetic, and Binary Codes

Positional Number Systems
  • Base/Radix (rr): Evaluates digits by positional weights rir^i: N=∑airiN = \sum a_i r^i.

    • Decimal (r=10r=10): Digits {0..9}\mathbf{\{0..9\}}.

    • Binary (r=2r=2): Digits {0,1}\mathbf{\{0, 1\}}. Positional weights: integer …,22=4,21=2,20=1\dots, 2^2=4, 2^1=2, 2^0=1; fractional 2−1=0.5,2−2=0.25,…2^{-1}=0.5, 2^{-2}=0.25, \dots.

    • Octal (r=8r=8): Digits {0..7}\mathbf{\{0..7\}}. Each digit equals 3 binary bits.

    • Hexadecimal (r=16r=16): Symbols {0..9,A..F}\mathbf{\{0..9, A..F\}} (A=10A=10 to F=15F=15). Each symbol equals 4 binary bits.

Base Conversions
  • Binary to Decimal: Sum each bit multiplied by its weight 2i2^i.

    • Example: (10110001)2=128+32+16+1=(177)10(10110001)_2 = 128 + 32 + 16 + 1 = (177)_{10}.

  • Decimal to Binary:

    • Integer: Repeatedly divide by 22; remainders yield bits from LSB to MSB. Example: (13)_{10} = (1101)_2$.\n - **Fractional:** Repeatedly multiply the fraction by 2; integer parts yield bits.\n- **Inter-conversion (Octal/Hex/Binary):** Group binary bits into sets of 3 for Octal or 4 for Hexadecimal starting from the binary point.\n\n### Signed Number Representation\n- **Sign Bit:** MSB indicates sign (0=positive,= positive,1 = negative).\n- **Formats:**\n - **Sign-Magnitude:** MSB is sign; remaining bits represent magnitude.\n - **1's Complement:** Invert all bits for negative numbers (0 \rightarrow 1, 1 \rightarrow 0).\n - **2's Complement:** \text{2's Complement} = \text{1's Complement} + 1.\n - **Direct Value Evaluation:** Assign MSB negative column weight -2^{n-1}.Example:. Example:11000110_2 = -128 + 64 + 4 + 2 = (-58){10}.\n\n### 2's Complement Arithmetic\n- **Addition:** Add all bits including the sign bit; **discard** any carry out of MSB.\n- **Subtraction:** Convert to addition with 2's complement of subtrahend: A - B = A + (-B).\n\n### Binary Codes\n- **Binary Coded Decimal (BCD):**\n - Encodes each decimal digit (0..9)intoa4−bitbinarygroup() into a 4-bit binary group (0000_2toto1001_2).\n - Codes 1010_2toto1111_2areinvalid.Example:are invalid. Example:(374){10} = (0011\ 0111\ 0100){\text{BCD}}.\n- **Gray Code (Reflected Binary Code):**\n - Unweighted code where consecutive numbers differ by only **1 bit** to prevent hardware glitches.\n - **Binary to Gray:** G_n = B_nandandG_i = B{i+1} \oplus B_i.Example:. Example:10110_2 = 11101_{\text{Gray}}.\n - **Gray to Binary:** B_n = G_nandandB_i = B_{i+1} \oplus G_i.Example:. Example:11011_{\text{Gray}} = 10010_2$$.