On Oct 9, 2012 9:20 AM, "Greg Ewing" <greg.ewing@canterbury.ac.nz> wrote:
> Oscar Benjamin wrote:
>> The main purpose of quiet NaNs is to propagate through computation
>> ruining everything they touch.
> 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.

I should expect that an experienced numericist would be aware of the possibility of a NaN and make a trivial modification of your loop to take advantage of the simple fact that any comparison with NaN returns false. It is only because you have artificially placed a not in the while clause that it doesn't work. I would have tested for error>eps without even thinking about NaNs.