Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
lgamma(3) OSS 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 and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcredll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycredll
SYNOPSIS
#include <math.h>
double lgamma(
double x);
extern int signgam;
PARAMETERS
x Specifies 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 defined as:
0
∫
∞
e
−t
t
x−1
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 defined 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 modified by
the call to the lgamma( ) function.
This function supports both IEEE Std 754-1985 floating-point and Tandem floating-point values
in the native environment. IEEE values can include NaN and infinity, 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 floating-point formats. Refer to the Guar-
dian Programmer’s Guide for a discussion of floating-point conversions.
4−92 Hewlett-Packard Company 527187-017