GAMMA — Gamma function#

GAMMA(X)#

GAMMA(X) computes Gamma (Gamma) of X. For positive, integer values of X the Gamma function simplifies to the factorial function Gamma(x)=(x-1)!.

Parameters

X – Shall be of type REAL and neither zero nor a negative integer.

Returns

The return value is of type REAL of the same kind as X.

Standard:

Fortran 2008 and later

Class:

Elemental function

Syntax:
X = GAMMA(X)
Example:
program test_gamma
  real :: x = 1.0
  x = gamma(x) ! returns 1.0
end program test_gamma
Specific names:

Name

Argument

Return type

Standard

DGAMMA(X)

REAL(8) X

REAL(8)

GNU extension

See also:

Logarithm of the Gamma function: LOG_GAMMA