TECHNOLOGY 

Published on
KembaraXtra-Computer Science-Number Systems
1. Introduction
  • Computers are digital machines that operate using 0s and 1s.
  • Understanding number systems is essential to understanding how computers work with numbers.
2. Decimal Numbers (Base 10)
  • The number system humans commonly use.
  • Uses ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
  • Employs place-value notation
2.1 Place-Value Notation
  • Each position in a number represents a different power of 10 (base 10).
  • Example: 275
    • 5 is in the ones place (10⁰ = 1), so its value is 5 * 1 = 5.
    • 7 is in the tens place (10¹ = 10), so its value is 7 * 10 = 70.
    • 2 is in the hundreds place (10² = 100), so its value is 2 * 100 = 200.
    • Total value: 5 + 70 + 200 = 275.
2.2 Powers of Ten
  • Each place is a power of 10.
    • Rightmost place: 10⁰ = 1 (ones place)
    • Next place: 10¹ = 10 (tens place)
    • Next place: 10² = 100 (hundreds place)
    • And so on (10³ = 1000, etc.)
2.3 Symbols
  • Decimal uses ten symbols (0-9) because each place can represent ten different values.
  • Any ten unique symbols could be used, but 0-9 is the convention.
3. Binary Numbers (Base 2)
  • The number system used by computers (two symbols)
  • Uses only two symbols: 0 and 1.
  • Still a place-value system, but each place represents a power of 2.
3.1 Place-Value Notation in Binary
  • Each position is a power of 2 (base 2).
  • Example: 101 (binary) which equals 5 (decimal)
    • Rightmost place: 2⁰ = 1
    • Next place: 2¹ = 2
    • Next place: 2² = 4
    • Total value: (1 * 1) + (0 * 2) + (1 * 4) = 1 + 0 + 4 = 5
3.2 Converting Binary to Decimal
  • Multiply the symbol in each place by the place-value weight (power of 2) and sum the results.
3.3 Converting Decimal to Binary
  • Find the largest power of 2 that is less than or equal to the decimal number.
  • Subtract that power of 2 from the decimal number and repeat the process with the remainder.
  • Put a 1 in the places corresponding to the powers of 2 that were used and a 0 in the other places.
3.4 Notation
  • To avoid confusion, binary numbers are often written with a 0b prefix (e.g., 0b10 represents 2 in binary).
  • Numbers without a prefix are assumed to be decimal.
·


Picture
0 Comments