On Tue, Oct 9, 2012 at 7:19 PM, Greg Ewing firstname.lastname@example.org wrote:
But they stop doing that as soon as they hit an if statement. It seems to me that the behaviour chosen for NaN comparison could just as easily make things go wrong as make them go right. E.g.
while not (error < epsilon): find_a_better_approximation()
If error ever ends up being NaN, this will go into an infinite loop.
But if you know that that's a possibility, you simply code your condition the other way:
while error > epsilon: find_a_better_approximation()
Which will then immediately terminate the loop if error bonks to NaN.