Handle NaN inputs in CDF

When sort.Float64sAreSorted is called, it panics on NaN inputs.

The way the code is written, there seems to be an intent that if the
input x contains a NaN, then the function should return a NaN.  I
switched the order of the conditional statements so that this became
possible.

I also modified the test cases so that cases with NaN could be
evaluated.