Float64s sorts a slice of float64s in increasing order (not-a-number values are treated as less than other values).
package main import ( "fmt" "math" "sort" ) func main() { s := []float64{5.2, -1.3, 0.7, -3.8, 2.6} // unsorted sort.Float64s(s) fmt.Println(s) s = []float64{math.Inf(1), math.NaN(), math.Inf(-1), 0.0} // unsorted sort.Float64s(s) fmt.Println(s) }