GAMMA intrinsic function

Standard: F77 F90 F95 F2003 F2008 F2018 Example program



X : Real;

Result : Same type and kind as X.

The value of X shall not be a negative integer or zero.


The value of the result is an approximation to the gamma function of X. The gamma function is the extension of factorial from the integers to the reals, so that when X is a positive integer, GAMMA(X) is an approximation to (X−1)! i.e. the factorial of (X−1). Like many intrinsic functions, this is elemental; the result has the same shape as X, with the operation being applied elementwise.

This function grows extremely rapidly with increasing X, so will overflow for quite modest values of X.


LOG_GAMMA intrinsic function