Standard library / sort
sort.Float64s()
Sorts the slice ascending in place; no stability guarantee. Floating-point NaNs precede all other values. Expected stdout: '[1.5 2.5 3.5]\n'.
Formal Syntax & Structure
go syntaxgo
func Float64s(x []float64)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | []float64 | Input value or collection to process. |
Working Example
Example Snippetgo
package main
import ( "fmt" "sort")
func main() { a := []float64{3.5, 1.5, 2.5} sort.Float64s(a) fmt.Println(a)}