Java's Double.compare does give NaN a total order. Rare win for the old thing.