Calculates the natural logarithm of the absolute value of gamma of the argument.
Include
<math.h>
Prototype
long double lgammal(long double x);
Argument
x
Return Value
Calculates the natural logarithm of the absolute value of gamma of the argument.
Remarks
A range error occurs if x
is too large. A range error might
occur if x
is less than or equal to zero.
Example
#include <math.h>
#include <stdio.h>
#include <errno.h>
int main(void)
{
long double x, y;
x = 0.5;
y = lgammal(x);
if(errno)
perror("Error");
printf("The natural log of gamma of %Lf is %Lf\n", x, y);
x = -0.75;
y = lgammal(x);
if(errno)
perror("Error");
printf("The natural log of gamma of %Lf is %Lf\n", x, y);
}
Example Output
The natural log of gamma of 0.500000 is 0.572365
The natural log of gamma of -0.750000 is 1.575705