[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

# Technical Reference: Base Operating System and Extensions, Volume 1

## lgamma, lgammaf, or lgammal Subroutine

### Purpose

Computes the log gamma.

### Syntax

```#include <math.h>

extern int signgam;

double lgamma (x)
double x;

float lgammaf (x)
float x;

long double lgammal (x)
long double x;```

### Description

The sign of ( x) is returned in the external integer signgam.

The lgamma, lgammaf, and lgammal subroutines are not reentrant. A function that is not required to be reentrant is not required to be thread-safe.

An application wishing to check for error situations should set the errno global variable to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these subroutines. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.

### Parameters

 x Specifies the value to be computed.

### Return Values

Upon successful completion, the lgamma, lgammaf, and lgammal subroutines return the logarithmic gamma of x.

If x is a non-positive integer, a pole error shall occur and lgamma, lgammaf, and lgammal will return +HUGE_VAL, +HUGE_VALF, and +HUGE_VALL.

If the correct value would cause overflow, a range error shall occur and lgamma, lgammaf, and lgammal will return ±HUGE_VAL, ±HUGE_VALF, ±HUGE_VALL, respectively.

If x is NaN, a NaN is returned.

If x is 1 or 2, +0 is returned.

If x is ±Inf, +Inf is returned.

### Related Information

math.h in AIX 5L Version 5.2 Files Reference.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]