Lesson Plan

Lesson Plan
Grade: Date: 25/02/2026
Subject: Computer Science
Lesson Topic: Show understanding of the consequences of a binary representation only being an approximation to the real number it represents (in certain cases)
Learning Objective/s:
  • Describe the IEEE 754 binary floating‑point format (sign, exponent, mantissa).
  • Explain why many decimal fractions cannot be represented exactly in binary.
  • Analyse the impact of rounding errors on equality tests, accumulation, and subtraction of nearly equal numbers.
  • Apply mitigation strategies such as tolerance comparisons, using double precision, and algorithmic re‑ordering.
Materials Needed:
  • Projector or interactive whiteboard
  • Slide deck covering IEEE 754 and binary conversion
  • Worksheets with conversion and error‑analysis tasks
  • Computers with a Java IDE (e.g., Eclipse) for coding demos
  • Handout of the “Common Pitfalls” table
  • Online binary converter or calculator
Introduction:

Start with a quick Java demo showing 0.1f + 0.2f producing an unexpected result. Review the previous lesson on integer representation and binary numbers. State that by the end of the lesson students will be able to predict when binary floating‑point approximations cause errors and choose safe programming practices.

Lesson Structure:
  1. Do‑now (5'): Students write the binary representation of 0.5 and discuss why 0.1 is problematic.
  2. Mini‑lecture (10'): Explain IEEE 754 components and demonstrate converting 0.1 to binary.
  3. Guided practice (10'): Complete the conversion worksheet together on the board.
  4. Coding demo (10'): Run Java snippets illustrating loss of equality and accumulation errors; students predict the output.
  5. Group activity (10'): Analyse a sample algorithm for overflow/underflow risks and propose mitigation strategies.
  6. Check for understanding (5'): Exit ticket – write one mitigation technique and when it should be used.
Conclusion:

Recap the key ideas: binary floating‑point stores approximations, rounding errors affect comparisons and calculations, and safe practices minimise their impact. Collect the exit tickets and remind students to complete the homework worksheet that reinforces conversion and error‑analysis skills. Suggest they experiment with both float and double in their own code to observe differences.