package cmp
Import Path
cmp (on go.dev)
Dependency Relation
imports 0 packages, and imported by one package
Involved Source Files
Package cmp provides types and functions related to comparing
ordered values.
Package-Level Type Names (only one, which is exported)
Ordered is a constraint that permits any ordered type: any type
that supports the operators < <= >= >.
If future releases of Go add new ordered types,
this constraint will be modified to include them.
Note that floating-point types may contain NaN ("not-a-number") values.
An operator such as == or < will always report false when
comparing a NaN value with any other value, NaN or not.
See the [Compare] function for a consistent way to compare NaN values.
Package-Level Functions (total 3, in which 2 are exported)
Type Parameters:
T: Ordered
Compare returns
-1 if x is less than y,
0 if x equals y,
+1 if x is greater than y.
For floating-point types, a NaN is considered less than any non-NaN,
a NaN is considered equal to a NaN, and -0.0 is equal to 0.0.
Type Parameters:
T: Ordered
Less reports whether x is less than y.
For floating-point types, a NaN is considered less than any non-NaN,
and -0.0 is not less than (is equal to) 0.0.
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |