Do not use the expression "signgam*exp(lgamma(x))" to compute g := |_(x). Instead use a program like this (in C):
lg = lgamma(x); g = signgam*exp(lg);
Only after lgamma or lgammaf has returned can signgam be correct.
For arguments in its range, tgamma is preferred, as for positive arguments it is accurate to within one unit in the last place. Exponentiation of lgamma will lose up to 10 significant bits.
gamma, gamma_r, gammaf, gammaf_r, lgamma, lgamma_r, lgammaf, and lgammaf_r return appropriate values unless an argument is out of range. Overflow will occur for sufficiently large positive values, and non-positive integers. For large non-integer negative values, tgamma will underflow.