ENH: Deal with NAN inputs and other corner cases.