Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)

lgamma(3) Guardian Native C Library Calls Reference Manual
NAME
lgamma - Computes the logarithm of the gamma function
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRESRL
G-series native OSS processes: /G/system/sysnn/zcresrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
H-series OSS processes: /G/system/zdllnnn/zcredll
SYNOPSIS
#include <math.h>
double lgamma(
double x);
extern int signgam;
PARAMETERS
x Species a positive double value.
DESCRIPTION
The lgamma() function returns the logarithm of the absolute value of the gamma of x, where the
gamma of x is dened as:
0
e
t
t
x1
dt
The names lgamma() and gamma() are different names for the same function. The gamma()
function is provided for compatibility with older versions of UNIX. The lgamma() function
should be used instead.
The sign of the gamma of x is stored in the external integer variable signgam. The x parameter
cannot be a nonpositive integer. The gamma of x is dened over the real numbers, except for the
nonpositive integers.
NOTES
Do not use the expression
g = signgam * exp (lgamma (x))
to compute
g = lgamma (x)
Instead, use the following sequence:
lg = lgamma (x);
g = signgam * exp (lg);
This is because the C language does not specify evaluation order, and signgam is modied by
the call to the lgamma() function.
This function supports both IEEE Std 754-1985 oating-point and Tandem oating-point values
in the native environment. IEEE values can include NaN and innity, and the sign of 0.0 (zero)
can be either positive or negative. Refer to the fp_class(3) reference page for a description of
IEEE value classes.
Guardian functions are available to convert between oating-point formats. Refer to the Guar-
dian Programmers Guide for a discussion of oating-point conversions.
418 Hewlett-Packard Company 527192-005