Optimise NaN test in insertion sort.