Home

Next: , Previous: , Up: Intrinsic Procedures   [Contents][Index]


9.118 GAMMA — Gamma function

Description:

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)!.

Standard:

Fortran 2008 and later

Class:

Elemental function

Syntax:

X = GAMMA(X)

Arguments:
XShall be of type REAL and neither zero nor a negative integer.
Return value:

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

Example:
program test_gamma
  real :: x = 1.0
  x = gamma(x) ! returns 1.0
end program test_gamma
Specific names:
NameArgumentReturn typeStandard
GAMMA(X)REAL(4) XREAL(4)GNU Extension
DGAMMA(X)REAL(8) XREAL(8)GNU Extension
See also:

Logarithm of the Gamma function: LOG_GAMMA