Standard library / math

math.Dim()

Positive difference max(x-y,0); NaN propagates. Expected stdout: '0\n'.

Formal Syntax & Structure

go syntaxgo
func Dim(x, y float64) float64

Parameters & Attributes

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

Return Value

float64

Positive difference max(x-y,0); NaN propagates.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math")
func main() {  fmt.Println(math.Dim(3, 5))}
Go Reference