Terry Reedy writes:
I wonder if it would be helpful to make a NaN subclass of floats with its own arithmetic and comparison methods.
It can't be helpful, unless you go a lot further. Specifically, you'd need to require containers to check every element for NaN-ness. That doesn't seem very practical. In any case, the presentation by Kahan (cited earlier by Alexander himself) demolishes the idea that any sort of attempt to implement DWIM for floats in a programming language can succeed at the present state of the art. The best we can get is DWGM ("do what Guido means", even if what Guido means is "ask the Timbot"<wink/>). Kahan pretty explicitly endorses this approach, by the way. At least in the context of choosing default policy for IEEE 754 Exceptions.