5.4.12. The logarithm of the gamma function (lgamma, lgamma_r)

double lgamma(double x);
double lgamma_r(double x, int *sign);

These functions compute the logarithm of the absolute value of the gamma function of x. The sign of the function is returned separately, so that the two can be used to compute the actual gamma function of x.

lgamma returns the sign of the gamma function of x in the global variable signgam. lgamma_r returns it in a user variable, whose address is passed in the sign parameter. The value, in either case, is either +1 or –1.

Both functions return an ERANGE error if the answer is too big to fit in a double.

Both functions return an EDOM error if x is zero or a negative integer.

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D