Number Systems in Computing: Binary, Decimal, Octal, and Hexadecimal
Number Systems in Computing: Binary, Decimal, Octal, and Hexadecimal
1. Introduction
In our daily lives, we use the base-10 number system (decimal)—likely because humans evolved with ten fingers to count on. However, digital computers operate on microscopic electronic switches that can only exist in one of two physical states: OFF (no electrical current) or ON (active electrical current).
Because computers only understand these two states, they rely on the Binary Number System (0 and 1).
To make large binary numbers easier for software developers and computer engineers to read, modern computing also uses Octal (base-8) and Hexadecimal (base-16). Understanding how these number systems work and how to convert between them is essential for studying memory addressing, web colors, and machine-level architecture.
2. Visual Sketchnote: Number Systems at a Glance
╔══════════════════════════════════════════════════════════════════════════════╗
║ NUMBER SYSTEMS SKETCHNOTE / QUICK MAP ║
╚══════════════════════════════════════════════════════════════════════════════╝
[ 1. DECIMAL (Base-10) ] [ 2. BINARY (Base-2) ]
• Everyday human system • Native machine language
• Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 • Digits: 0, 1 (Bits)
• Weights: 10^2, 10^1, 10^0 • Weights: 2^3, 2^2, 2^1, 2^0
┌──────────────────────────┐ ┌──────────────────────────┐
│ (45)₁₀ = 4×10¹ + 5×10⁰ │ │ (1011)₂ = 8 + 0 + 2 + 1 │
│ = 40 + 5 │ │ = (11)₁₀ │
└──────────────────────────┘ └──────────────────────────┘
────────────────────────────────────────────────────────────────────────────────
[ 3. OCTAL (Base-8) ] [ 4. HEXADECIMAL (Base-16) ]
• Groups 3 binary bits • Groups 4 binary bits (1 Nibble)
• Digits: 0, 1, 2, 3, 4, 5, 6, 7 • Digits: 0–9 and A–F
• Used in older systems, Unix perms • A=10, B=11, C=12, D=13, E=14, F=15
┌──────────────────────────┐ ┌──────────────────────────┐
│ Binary: 110 101 │ │ HTML Color Code: #FF0000 │
│ Octal: 6 5 = (65)₈ │ │ (255 Red, 0 Green, 0 Blue│
└──────────────────────────┘ └──────────────────────────┘
════════════════════════════════════════════════════════════════════════════════
3. Core Characteristics of the 4 Number Systems
| Number System | Base (Radix) | Available Digits / Symbols | Real-World Application in ICT |
|---|---|---|---|
| Binary | Base 2 | 0, 1 | CPU machine code, logic gates, digital storage |
| Octal | Base 8 | 0, 1, 2, 3, 4, 5, 6, 7 | Linux file system permissions (e.g., chmod 755) |
| Decimal | Base 10 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 | Standard human mathematics, user-facing inputs |
| Hexadecimal | Base 16 | 0–9 and A, B, C, D, E, F | RAM memory addresses, MAC addresses, CSS hex colors |
4. Converting Decimal to Binary: The "Divide-by-2" Method
To convert a decimal integer into binary:
* Divide the number by 2.
* Write down the integer quotient and record the remainder (0 or 1) on the side.
* Repeat the division with the quotient until the quotient reaches 0.
* Read the remainders from bottom to top (Most Significant Bit to Least Significant Bit).
Example: Convert (25)_{10} to Binary
2 | 25 Remainder: 1 (LSB - Least Significant Bit)
2 | 12 Remainder: 0
2 | 6 Remainder: 0
2 | 3 Remainder: 1
2 | 1 Remainder: 1 (MSB - Most Significant Bit)
0
Reading from bottom to top: (25)₁₀ = (11001)₂
Verification:
5. Why Hexadecimal Matters in Modern ICT
Binary numbers quickly become unwieldy for humans to read (e.g., the 8-bit byte 11111111 equals decimal 255).
Hexadecimal simplifies this by representing every 4 bits (1 nibble) with exactly one hex digit:
* 0000 = 0
* 1010 = A (10)
* 1111 = F (15)
Real-World Examples:
* HTML/CSS Colors: White is #FFFFFF (RR=FF, GG=FF, BB=FF), representing full RGB intensity (255, 255, 255). Pure red is #FF0000.
* Hardware MAC Addresses: Every network card (NIC) has a unique physical address formatted in hex, such as 00:1A:2B:3C:4D:5E.
6. Hands-on Lab Activity: Base Conversion in Python
Students can use the interactive Python shell in their ICT lab to convert between number systems using built-in conversion functions:
# ==========================================
# ICT Lab Exercise: Number Base Converter
# ==========================================
decimal_num = int(input("Enter any decimal number: "))
# Built-in conversions
binary_repr = bin(decimal_num) # Prefixed with '0b'
octal_repr = oct(decimal_num) # Prefixed with '0o'
hex_repr = hex(decimal_num) # Prefixed with '0x'
print("\n--- CONVERSION RESULTS ---")
print(f"Decimal (Base 10) : {decimal_num}")
print(f"Binary (Base 2) : {binary_repr} -> Clean: {binary_repr[2:]}")
print(f"Octal (Base 8) : {octal_repr} -> Clean: {octal_repr[2:]}")
print(f"Hex (Base 16) : {hex_repr.upper()} -> Clean: {hex_repr[2:].upper()}")
Try This:
* Enter 255 and observe that binary is 11111111 and hex is FF.
* Enter 16 and observe that hex is 10.
7. Review Questions & Key Answers
Q1: How many bits make up one Hexadecimal digit?
* Answer: 4 bits (also known as a nibble).
Q2: What do the letters A through F represent in the Hexadecimal number system?
* Answer: They represent the values 10 through 15 (A = 10, B = 11, C = 12, D = 13, E = 14, F = 15).
Q3: Convert the binary value 1010 to decimal.
* Answer: 10.
Comments
Post a Comment