lgamma(), lgammaf(), lgamma_r(), lgammaf_r(), gamma(), gammaf(), gamma_r(), gammaf_r(), tgamma(), tgamma_f()

log gamma function 

Function


SYNOPSIS

#include <math.h>

extern int signgam;

double lgamma(double x)

float lgammaf(float x)

double lgamma_r(double x, int *sign)

float lgammaf_r(float x, int *sign)

double gamma(double x)

float gammaf(float x)

double gamma_r(double x, int *sign)

float gammaf_r(float x, int *sign)

long double fgamma(double x)

float tgammaf(float x)


DESCRIPTION

The gamma() function computes

where

is defined as:

The sign of

is returned in the external integer signgam. This function is identical to gamma().

gamma_r(), gammaf_r(), lgamma_r(), and lgammaf_r(), are a reentrant interfaces that performs identically to the corresponding functions, differing in that the sign is stored in the location pointed to by the sign argument and signgam is not modified.

Do not use the expression "signgam*exp(lgamma(x))" to compute g := GAMMA(x). Instead use a program like this (in C):

lg = lgamma(x); g = signgam*exp(lg);

Only after lgamma() has returned can signgam be correct.


PARAMETERS

sign 

Is the location where the resulting sign is stored.

x 

Is the value whose logarithmic gamma is computed.


RETURN VALUES

On success the gamma() and lgamma() functions return the logarithmic gamma of x, as defined above.

If x is NaN, NaN is returned.

If x is a non-positive integer, then:

If the correct value would cause underflow, 0 is returned.


CONFORMANCE

UNIX 98.

tgamma() and tgammaf() conform to ANSI/ISO 9899:1999 'ISO C99'.


MULTITHREAD SAFETY LEVEL

Unsafe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
math()


PTC MKS Toolkit 10.4 Documentation Build 39.