Ch18 Discussion

Discussion Guide

Warm-up (think–pair–share, 5 min). "You inherit a 40-year-old, validated, ugly Fortran code that runs your group's core analysis. Your first instinct?" Surface the rewrite impulse, then the chapter's answer.

Main discussion (15–20 min). 1. The negation trap. Show the legacy IF (DMAX .GT. TOL .AND. ITER .LT. MAXIT) GO TO 60 and ask the class to write the modern exit. Collect wrong answers (there will be .and. versions); derive the correct negation together. Tie to why a regression test is non-optional. 2. Bit-for-bit or close enough? Give five migration steps (add implicit none; COMMON→module; realreal(dp); reorder a sum; GOTOdo) and have the class sort each into "demand bit-for-bit" vs "validate to tolerance." Debate the borderline cases. 3. Rewrite or refactor, revisited. Contrast with Ch. 1's Case Study 2. Now that they can do the modernization, does the calculus change? (It should feel less risky — that's the point.)

Group activity (10 min). In pairs, hand each team a 6–8 line fixed-form fragment (a COMMON block + a small GOTO loop). They modernize it on paper, then state the acceptance test they'd run and whether it should be bit-for-bit. Collect one or two and critique the exit conditions live.

Exit ticket. "Name the three things that must be preserved for a migration to be bit-for-bit." (Answer: precision, the operations, and their order — plus, for full credit, that it's pinned to a compiler and flags.)