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) float64

Parameters & Attributes

NameTypeDescription
xfloat64First input operand (or sole input if unary).
yfloat64Second 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))}
Go Reference