cc [ flag ... ] file ... -lm [ library ... ]
#include <math.h>
extern int signgam;
double lgamma(double x);
double lgamma_r(double x, int *signgamp);
See the NOTES section of this page.
Both lgamma() and
lgamma_r() return
ln|*G(x)| where *G(x) = integral from 0 to +Infinity of pow(t,x-1)*exp(-t) dt for x > 0 and *G(x) = *p/(*G(1-x)sin(*px)) for x < 1. }