Standard library / math

math.Max()

Larger float; +Inf takes precedence over NaN, +0 wins against -0. Expected stdout: '7\n'.

Formal Syntax & Structure

go syntaxgo
func Max(x, y float64) float64

Parameters & Attributes

NameTypeDescription
xfloat64First input operand (or sole input if unary).
yfloat64Second input operand.

Return Value

float64

Larger float; +Inf takes precedence over NaN, +0 wins against -0.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math")
func main() {  fmt.Println(math.Max(2, 7))}
Go Reference