-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed
Milestone
Description
The slices.Sort doesn't support sorting slices of floating-point numbers containing Not-a-number (NaN) values, It's not very intuitive.
Once the slices package is merged into stdlib, the sort.{TYPE}s(e.g. sort.Ints, sort.Float64s) APIs may be semi-deprecated. But the slices package doesn't provide a simple way to sort slices of floats containing NaNs, it recommends using slices.SortFunc(x, func(a, b float64) bool {return a < b || (math.IsNaN(a) && !math.IsNaN(b))}), this function is very complex compared to using sort.Float64s.
Related CL: https://go-review.googlesource.com/c/exp/+/446155
DeedleFake, SilverRainZ, cespare and Dup4