Cost validity check

Do you need to reverse the order of these I wonder?  What does NaN < 0 evaluate to?