Skip to content

Commit 39d4317

Browse files
zhangyunhao116randall77
authored andcommitted
slices: add package-level documentation for less function
Document that the less function requires strict weak ordering. Fixes golang/go#52518 Change-Id: Ia2d5f3137932b4c0fb0da4bfdf12f8d69b2672de Reviewed-on: https://go-review.googlesource.com/c/exp/+/402534 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Eli Bendersky <[email protected]> Reviewed-by: Eli Bendersky <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent 3bcf042 commit 39d4317

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

slices/slices.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
// Package slices defines various functions useful with slices of any type.
66
// Unless otherwise specified, these functions all apply to the elements
77
// of a slice at index 0 <= i < len(s).
8+
//
9+
// Note that the less function in IsSortedFunc, SortFunc, SortStableFunc requires a
10+
// strict weak ordering (https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings),
11+
// or the sorting may fail to sort correctly. A common case is when sorting slices of
12+
// floating-point numbers containing NaN values.
813
package slices
914

1015
import "golang.org/x/exp/constraints"

0 commit comments

Comments
 (0)