COMP101: Introduction to Computing - Number Systems
Course Overview and Institutional Integration
Course Information:
- Course Code & Title: COMP101: Introduction to Computing
- Module: Module 2: Number System (Weeks 4 and 5)
- Institution: Kolehiyo ng Lungsod ng Dasmariñas (KLD)
- Academic Department: Institute of Foundational Studies
- Address: Brgy. Burol Main, City of Dasmariñas, Cavite, Philippines 4114
- Website: www.kld.edu.ph
Course Outcomes & Intended Learning Outcomes:
- Course Outcome (CO4): Determine and transform number system conversions.
- Intended Learning Outcome (LO1): Learn the different types of number systems.
SDG and KLD REGAL100 Integration:
- SDG 4: Quality Education
- SDG 8: Decent Work and Economic Growth
- SDG 9: Industry, Innovation, and Infrastructure
- REGAL 100: Information Literacy Program
Introduction to Number Systems
Definition and Context:
- A number system is a structured way to represent or express numbers.
- Numbers represented in any specific number system category can be converted into any other system.
- Standard mathematical number systems include whole numbers and real numbers, but computer architecture utilizes specialized digital number systems.
Rationale for Digital Systems:
- In digital hardware, instructions and data are transmitted using electric signals.
- Signal variations are controlled by varying signal voltage.
- Implementing ten distinct voltage levels to process the decimal system directly in digital equipment is technically complex and unreliable.
- Consequently, digital systems rely on alternative positional number systems that are simpler to implement using binary voltage logic.
Four Core Computer Number Systems:
- Decimal Number System
- Binary Number System
- Octal Number System
- Hexadecimal Number System
Characteristics of Core Number Systems
Decimal Number System:
- Base / Radix:
- Digits Used: digits ()
- Positional weight increases to the left of the decimal point, representing units, tens, hundreds, thousands, and so on.
- Every position corresponds to an increasing power of the base .
- Digit values are strictly position-dependent. For example, considering the value of the digit across three different numbers:
- In , the value of is hundreds = = =
- In , the value of is tens = = =
- In , the value of is units = = =
Binary Number System:
- Base / Radix:
- Digits Used: digits ( and )
- Represents the hardware switch states: off () and on ().
- Bit Definition: A single binary digit is called a bit.
- Positional values are represented by increasing powers of .
- Key Terms:
- Least Significant Bit (LSB): The rightmost digit in a binary number.
- Most Significant Bit (MSB): The leftmost digit in a binary number.
- Decimal Evaluation Example:
Computer Memory Capacity Conversion Table:
Octal Number System:
- Base / Radix:
- Digits Used: digits ()
- Widely used in computer applications and electronic systems.
Hexadecimal Number System:
- Base / Radix:
- Digits/Symbols Used: symbols ()
- Each position represents a power of .
- Because the base exceeds , standard numeric digits are supplemented by alphabetic letters:
- The inclusion of letters through is purely conventional.
Decimal Conversion Methods
Decimal to Binary Conversion:
- Procedure: Repeatedly divide the decimal integer by , record the remainder at each step, and continue until the quotient becomes . Write the remainders in backward order (from bottom to top, LSB to MSB).
- Example: Convert to binary.
- with remainder
- with remainder
- with remainder
- with remainder
- with remainder
- Reading remainders backward yields:
Decimal to Octal Conversion:
- Procedure: Repeatedly divide the decimal integer by , record the remainder at each step, and continue until the quotient is . Write remainders in backward order.
- Example: Convert to octal.
- with remainder
- with remainder
- with remainder
- Reading remainders backward yields:
Octal to Decimal Conversion:
- Procedure: Multiply each digit of the octal number by decreasing powers of base , starting from MSB to LSB, and sum all products together.
- Example 1: Convert to decimal.
- Example 2: Convert to decimal.
Decimal to Hexadecimal Conversion:
- Procedure: Repeatedly divide the decimal integer by , record the remainder, and write the remainders backward when quotient reaches 0$.\n * **Example:** Convert 128_{10} to hexadecimal.\n * 128 / 16 = 80\n * 8 / 16 = 08\n * Reading remainders backward yields: 128_{10} = 80_{16}\n\n* **Hexadecimal to Decimal Conversion:**\n * **Procedure:** Multiply each hexadecimal digit by powers of 1616^0) at the LSB and increase powers moving left to the MSB, then sum the terms.\n * **Example:** Convert 7 ext{CF}{16} to decimal.\n * Hexadecimal symbol values: 7 = 7 ext{C} = 12 ext{F} = 15\n * 7 ext{CF}{16} = (7 imes 16^2) + (12 imes 16^1) + (15 imes 16^0)\n * 7 ext{CF}{16} = (7 imes 256) + (12 imes 16) + (15 imes 1)\n * 7 ext{CF}{16} = 1792 + 192 + 15 = 1999_{10}\n\n# Binary Conversion Methods\n\n* **Binary to Decimal Conversion:**\n * **Procedure:** Multiply each binary digit starting from MSB to LSB by decreasing powers of the base 2, then sum all terms.\n * **Example:** Convert 1101_2 to decimal.\n * 1101_2 = 1 imes 2^3 + 1 imes 2^2 + 0 imes 2^1 + 1 imes 2^0\n * 1101_2 = 8 + 4 + 0 + 1 = 13_{10}\n\n* **Binary to Octal Conversion Methods:**\n * Direct one-step manual conversion is not typically used; two main systematic methods exist.\n * **Method 1 (Indirect via Decimal):**\n * Step 1: Identify the binary number.\n * Step 2: Convert binary to decimal by multiplying each digit by 2^{n-1}n is digit position from the right).\n * Step 3: Compute the equivalent decimal sum.\n * Step 4: Divide the resulting decimal number by 8$.
- Step 5: Note the remainder.
- Step 6: Repeat division with the quotient until quotient equals 0$.\n * Step 7: Write the remainders in reverse order.\n * Step 8: The resulting digits form the target octal number.\n * **Example:** Convert 1011101_2 to octal.\n * Binary to Decimal: 1011101_2 = (1 imes 2^6) + (0 imes 2^5) + (1 imes 2^4) + (1 imes 2^3) + (1 imes 2^2) + (0 imes 2^1) + (1 imes 2^0)\n * 1011101_2 = 64 + 0 + 16 + 8 + 4 + 0 + 1 = 93_{10}\n * Decimal to Octal (Divide 938):\n * 93 / 8 = 115\n * 11 / 8 = 13\n * 1 / 8 = 01\n * Collecting remainders in reverse order gives: 135_8\n * Therefore, 1011101_2 = 135_8\n * **Method 2 (Direct Grouping):**\n * Step 1: Identify the binary number (base 201).\n * Step 2: Group binary digits into sets of three starting from the right side.\n * Step 3: Add leading zeros to the left if the leftmost group contains fewer than three digits.\n * Step 4: Map each 3-bit group to its octal equivalent digit.\n * Step 5: Concatenate the resulting octal digits.\n * **Example:** Convert 01110101_2 to octal.\n * Grouping into 3-bit sets: 001 / 110 / 101\n * Converting groups: 001_2 = 1110_2 = 6101_2 = 5\n * Output octal value: 165_8\n\n# Octal to Binary Conversion\n\n* **Procedural Steps (Two-Step Process):**\n * **Step 1: Octal to Decimal Conversion**\n * Count the total number of digits (n).\n * Multiply each digit in the n^ ext{th}8^{n-1}.\n * If a fractional component exists, multiply fractional digits in the m^ ext{th}8^{-m}.\n * Sum all products to obtain the equivalent decimal number.\n * **Step 2: Decimal to Binary Conversion**\n * Divide the resulting decimal number by 2$.
- Note down the remainder.
- Continue dividing the quotient by until the quotient reaches 0$.\n * Write remainders in reverse order to produce the equivalent binary number.\n\n* **Demonstration Example:** Convert 41_8 to binary.\n * Step 1 (Octal to Decimal):\n * 41_8 = (4 imes 8^1) + (1 imes 8^0) = 4 imes 8 + 1 imes 1 = 32 + 1 = 33_{10}\n * Step 2 (Decimal to Binary):\n * 33 / 2 = 161\n * 16 / 2 = 80\n * 8 / 2 = 40\n * 4 / 2 = 20\n * 2 / 2 = 10\n * 1 / 2 = 01\n * Writing remainders backward yields: 100001_2\n * Therefore, 41_8 = 100001_2\n\n# Binary to Hexadecimal Conversion\n\n* **Purpose:** Provides a compact way to group and represent large binary strings.\n\n* **Indirect Method (Binary to Decimal to Hexadecimal):**\n * **Example:** Convert 1101010_2 to hexadecimal.\n * Convert Binary to Decimal:\n * 1101010_2 = 1 imes 2^6 + 1 imes 2^5 + 0 imes 2^4 + 1 imes 2^3 + 0 imes 2^2 + 1 imes 2^1 + 0 imes 2^0\n * 1101010_2 = 64 + 32 + 0 + 8 + 0 + 2 + 0 = 106_{10}\n * Convert Decimal to Hexadecimal:\n * 106_{10} = 6 imes 16^1 + 10 imes 16^0 = 6 ext{A}{16}\n * Answer: 6 ext{A}{16}\n\n* **Direct Grouping Method:**\n * Because base 16160-9 ext{A}- ext{F}2^4 = 16).\n * **Algorithm Steps:**\n * Group binary digits into sets of four.\n * For integer parts, start grouping from right to left.\n * For fractional parts, start grouping from left to right.\n * Pad with leading 00s on the far right (LSB) for fractions to complete any incomplete 4-bit set.\n * Replace each 4-bit set with its corresponding hexadecimal digit.\n * **Example 1 (Integer Number):** Convert 1010101101001_2 to hexadecimal.\n * Grouping from right: 1 imes 0101 imes 0110 imes 1001\n * Add leading zeros to complete 4-bit groups: 0001 imes 0101 imes 0110 imes 1001\n * Map each group: 0001_2 = 10101_2 = 50110_2 = 61001_2 = 9\n * Result: 1569_{16}\n * **Example 2 (Fractional Number):** Convert 001100101.110111_2 to hexadecimal.\n * Integer grouping (right to left from point): 001100101 ightarrow 0 imes 0110 imes 0101 ightarrow 0110 imes 0101 = 6 imes 5\n * Fractional grouping (left to right from point): .110111 ightarrow .1101 imes 1100 = ext{D} imes ext{C}\n * Result: 65. ext{DC}_{16}\n\n# Hexadecimal to Binary Conversion\n\n* **Indirect Conversion Steps (Hexadecimal to Decimal to Binary):**\n * Step 1: Take the given hexadecimal number.\n * Step 2: Determine the total number of digits (n).\n * Step 3: Multiply each digit by 16^{n-1}n from the right.\n * Step 4: Sum all multiplied products together.\n * Step 5: Obtain the equivalent decimal integer.\n * Step 6: Divide the decimal number by 2$.
- Step 7: Record the remainder.
- Step 8: Repeat division with the quotient until quotient equals 0$.\n * Step 9: Write remainders in reverse order.\n * Step 10: Output the derived binary sequence.\n\n# Inter-System Conversions (Octal and Hexadecimal)\n\n* **Octal to Hexadecimal Conversion Methods:**\n * Direct single-step mapping between octal and hexadecimal is unavailable; two indirect pathways are applied.\n * **Method A (Via Binary Representation):**\n * Step 1: Express every individual octal digit as a 3-bit binary pattern.\n * Step 2: Regroup the continuous binary pattern into 4-bit groups (from right to left).\n * Step 3: Convert each 4-bit binary group into its corresponding hexadecimal digit.\n * Reference values: 5_8 = 101_26_8 = 110_2\n * **Example:** Convert 56_8 to hexadecimal.\n * Step 1: Convert 56_85 ightarrow 1016 ightarrow 110 ightarrow 101110_2\n * Step 2: Regroup into 4-bit sets from right: 10 imes 1110 ightarrow 0010 imes 1110\n * Step 3: Map to hex: 0010_2 = 21110_2 = 14 = ext{E}\n * Answer: 2 ext{E}_{16}\n * **Method B (Via Decimal Representation):**\n * Step 1: Convert octal to decimal.\n * Step 2: Convert decimal to hexadecimal via repeated division by 16$.
- Example: Convert to hexadecimal.
- Step 1 (Octal to Decimal):
- Step 2 (Decimal to Hexadecimal):
- remainder ()
- remainder
- Reading remainders backward yields:
Hexadecimal to Octal Conversion:
- Procedure: Cannot be converted directly. Convert the hexadecimal number to its equivalent decimal number, then convert the decimal number to octal.
- Step-by-Step Algorithm:
- Step 1: Take the hexadecimal input and count its digits.
- Step 2: Multiply each digit in position from the right by .
- Step 3: Sum all terms to compute the equivalent decimal number.
- Step 4: Divide the resulting decimal number by 8$.\n * Step 5: Note down the remainder.\n * Step 6: Repeat division with the quotient until quotient equals 0$.
- Step 7: Write all remainders in reverse order.
- Step 8: The resulting sequence is the equivalent octal number.