ANSI C99 and POSIX compliant compilers include functions tgamma
and lgamma
for computing the gamma function and its natural logarithm respectively. Visual Studio, however, does not support these standards.
Why are there separate functions for gamma and its logarithm? See this post for an explanation.
Here is stand-alone C++ code for the functions Gamma
and LogGamma
. Both require a positive argument.
Note that the functions Gamma
and LogGamma
are mutually dependent, but do not depend on anything else.