GoLang – Find Gamma – Gamma() Function – Examples & Explanation

Gamma() function is used to find the Gamma function of the given input (x – parameter) in Go language. The standard math package of Go programming language has Gamma() function.

Syntax of Gamma() Function in Go

The syntax of Gamma() 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:
Gamma(+Inf) = +Inf
Gamma(+0) = +Inf
Gamma(-0) = -Inf
Gamma(x) = NaN for integer x < 0
Gamma(-Inf) = NaN
Gamma(NaN) = NaN


Parameters of Gamma() Function in Go Programming

x – Where x is any Valid float64 Input value. This parameter is required.


Error Handling

If the x parameter is not a number (numeric value) Gamma() function returns an error .
If there is no argument (x – input value) passes to the function, then the compiler will produce an error.


Return Value of Gamma() Function in Go Programming

Gamma() function will return the Gamma function of the given input(x – parameter).


GoLang Gamma() Function Example 1



GoLang Gamma() Function Example 2



GoLang Gamma() Function Example 3