Standard library / math
math.Min()
Smaller float; -Inf takes precedence over NaN, -0 wins against +0. Expected stdout: '2\n'.
Formal Syntax & Structure
go syntaxgo
func Min(x, y float64) float64Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | float64 | First input operand (or sole input if unary). |
| y | float64 | Second input operand. |
Return Value
float64
Smaller float; -Inf takes precedence over NaN, -0 wins against +0.
Working Example
Example Snippetgo
package main
import ( "fmt" "math")
func main() { fmt.Println(math.Min(2, 7))}