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

gamma(3) Guardian Native C Library Calls Reference Manual
NAME
gamma - 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 gamma(
double x);
extern int signgam;
PARAMETERS
x Specifies a positive double value.
DESCRIPTION
The gamma() 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
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 defined over the real numbers, except for the
nonpositive integers.
NOTES
Do not use the expression
g = signgam * exp (gamma (x))
to compute
g = gamma (x)
Instead, use the following sequence:
lg = gamma (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 gamma() 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.
32 Hewlett-Packard Company 527192-007