Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

GoLang – Find Maximum of x-y or 0 – Dim() Function – Examples & Explanation

Dim() function is used to find the maximum of x-y or 0 of the given inputs (x,y – parameters) in Go language. The standard math package of Go programming language has Dim() function.

Syntax of Dim() Function in Go Language

The syntax of Dim() function in Go Language is:

Note: float64 is a data type in Go language which has IEEE-754 64-bit floating-point numbers.
Special cases are:
Dim(+Inf, +Inf) = NaN
Dim(-Inf, -Inf) = NaN
Dim(x, NaN) = Dim(NaN, x) = NaN


Parameters of Dim() Function in Go Language

x – Where x and y are any Valid float64 Input value. These parameters are required.


Error Handling

If the x or y parameters are not a number (numeric value) Dim() function will return an error .
If there are no arguments (x or y – input values) passes to the function, then the compiler will produce an error.


Return Value of Dim() Function in Go Language

Dim() function will return the maximum of x-y or 0 of the given input(x , y – parameters).


GoLang Dim() Function Example 1



GoLang Dim() Function Example 2



GoLang Dim() Function Example 3


LearnAndLearn.com © 2018 - All rights reserved