Standard library / sort
sort.Float64sAreSorted()
Reports whether the slice is already in ascending order. Floating-point NaNs precede all other values. Expected stdout: 'true false\n'.
Formal Syntax & Structure
go syntaxgo
func Float64sAreSorted(x []float64) boolParameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | []float64 | Input value or collection to process. |
Return Value
bool
Reports whether the slice is already in ascending order. Floating-point NaNs precede all other values.
Working Example
Example Snippetgo
package main
import ( "fmt" "sort")
func main() { fmt.Println(sort.Float64sAreSorted([]float64{1.5, 2.5, 3.5}), sort.Float64sAreSorted([]float64{3.5, 1.5, 2.5}))}