Answer

When the loop terminates, we would like to have narrowed down the difference between pos and neg to 1e-5 or less. (That way, if we report their average as the result, the comment for bisection will be satisfied.) One way to ensure that a condition will be true when a loop terminates is to make the opposite of that condition control the loop.

Return to lesson.



Joseph L. Zachary
Hamlet Project
Department of Computer Science
University of Utah