Understanding Real Numbers in Binary

Sep 20, 2024

Lecture Notes: Representing Real Numbers in Binary

Introduction

  • Focus on representing real numbers with binary, particularly those with fractional parts (decimal parts).
  • Explore the concept of binary representation of partial numbers.

Place Value System

  • Decimal System:
    • Base-10 place value.
    • Example: 3725 = 3 thousands, 7 hundreds, 2 tens, 5 ones.
  • Binary System:
    • Base-2 place value.
    • Example: 0101 in binary = 1 eight, 0 fours, 1 two, and 0 ones; equals 10 in decimal.

Extending Place Value with Fractions

  • Decimal Fractions:
    • Tenths: 10^-1 = 0.1
    • Hundredths: 10^-2 = 0.01
  • Binary Fractions:
    • Halves: 2^-1 = 0.5
    • Quarters: 2^-2 = 0.25
    • Example: 10.75 in decimal can be represented as 10.11 in binary (1 half + 1 quarter).

Fixed Point Representation

  • Fixed point representation is impractical for precision beyond set fractional bits.
  • Example: Representing "one and a 20th" becomes challenging.
  • Human conventions like repeating decimals (e.g., 0.33 repeating) can't be replicated in binary.

Floating Point Representation

  • Scientific Notation in Computing:
    • Mantissa (significand) and exponent used to store numbers.
    • Similar to scientific notation but uses base 2.
  • Floating Point Notation:
    • Allows moving the "decimal" point to represent different degrees of precision.
    • Limitation: Cannot represent infinite numbers between 0 and 1.

IEEE Standards

  • Single Precision (Floats):
    • 32-bit representation.
  • Double Precision (Doubles):
    • 64-bit representation.

Hardware Considerations

  • Floating point operations require different circuitry than integer operations.
  • Integer circuitry is essential for non-math operations, notably in memory management.

Key Takeaways

  • Understanding of single precision and double precision.
  • Knowledge of floating point as a form of scientific notation in computing.
  • Future focus: Memory operations in upcoming course modules.