# lgammal Function

Calculates the natural logarithm of the absolute value of gamma of the long double-precision floating-point argument.

Include

<math.h>

Prototype

long double lgammal(long double x);

Argument

 x value to evaluate the natural logarithm of the absolute value of gamma

Return Value

Returns the natural logarithm of the absolute value of gamma of the argument.

Remarks

A range error occurs if x is too large, and errno will be set to ERANGE.

Example

See the notes at the beginning of this chapter or section for information on using printf() or scanf() (and other functions reading and writing the stdin or stdout streams) in the example code.

#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