Open System Services System Calls Reference Manual (G06.28+)
System Functions (k - m) lgamma_r(2)
NAME
lgamma_r - Computes the logarithm of the gamma function (reentrant)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <math.h>]
#include <spthread.h>
double lgamma_r (
double x,
int *signgamp );
extern int signgam;
PARAMETERS
x Specifies a positive double value.
signgamp Points to the sign of the lgamma_r() function.
DESCRIPTION
The lgamma_r() function is the reentrant version of the lgamma() function.
The lgamma_r() 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 sign of the gamma of x is stored in the external integer variable signgam. The value of
signgamp is updated with the value of signgam for the sign of the lgamma_r() function.
The x parameter cannot be a nonpositive integer. The gamma of x is defined over the real
numbers, except for the nonpositive integers.
NOTES
The names lgamma_r() and gamma_r() are different names for the same function. The
gamma_r() function is provided for compatibility with older versions of UNIX. The
lgamma_r() function should be used instead.
To compute gamma, use the expression:
g = signgamp * exp(lgamma_r(x,*signgamp));
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.
RETURN VALUES
Upon successful completion, the lgamma_r() function returns the logarithmic gamma of x.
For IEEE floating-point values, if the value of x is NaN, NaN is returned. If the value of x is
positive infinity, NaN is returned. If the value of x is negative infinity, HUGE_VAL is returned
and errno is set to [EDOM].
If the value of x is 0.0 (zero), HUGE_VAL is returned and errno is set to [EDOM]. If the value
of x is a nonpositive integer, HUGE_VAL is returned and errno is set to [EDOM].
527186-005 Hewlett-Packard Company 4−13