added NaN test for sort (based on Peter Li's agrad-rev test code)
added NaN test for sort_indices (based on Peter Li's agrad-rev test code)
added NaN test for distance