Comprehensive Study Guide: Number Systems, Base Conversions, Signed Arithmetic, and Binary Codes
Positional Number Systems
Base/Radix (): Evaluates digits by positional weights : .
Decimal (): Digits .
Binary (): Digits . Positional weights: integer ; fractional .
Octal (): Digits . Each digit equals 3 binary bits.
Hexadecimal (): Symbols ( to ). Each symbol equals 4 binary bits.
Base Conversions
Binary to Decimal: Sum each bit multiplied by its weight .
Example: .
Decimal to Binary:
Integer: Repeatedly divide by ; 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 (01 = 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}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..90000_21001_2).\n - Codes 1010_21111_2(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_nG_i = B{i+1} \oplus B_i10110_2 = 11101_{\text{Gray}}.\n - **Gray to Binary:** B_n = G_nB_i = B_{i+1} \oplus G_i11011_{\text{Gray}} = 10010_2$$.