lgammad32(), lgammad64(), lgammad128() - Log gamma function

Standards

Standards / Extensions C or C++ Dependencies
C/C++ DFP
both z/OS® V1.10

Format

#define __STDC_WANT_DEC_FP__
#include <math.h>

_Decimal32  lgammad32(_Decimal32 x);
_Decimal64  lgammad64(_Decimal64 x);
_Decimal128 lgammad128(_Decimal128 x);
_Decimal32  lgamma(_Decimal32 x);     /* C++ only */
_Decimal64  lgamma(_Decimal64 x);     /* C++ only */
_Decimal128 lgamma(_Decimal128 x);    /* C++ only */

General description

The lgamma() function computes the
Formula of the functions
is defined as
Description of the formula
The sign of
Description of the formula

is returned in the external integer signgam. The argument x may not be a non-positive integer.

In a multithreaded process, each thread has its own instance of the signgam variable. Threads access their instances of the variable by calling the __signgam() function. The math.h header redefines the string signgam to an invocation of the __siggam function. The actual signgam external variable is used to store the signgam value for the IPT.

These functions work in IEEE decimal floating-point format. See IEEE decimal floating-point for more information.

Note: To use IEEE decimal floating-point, the hardware must have the Decimal Floating-Point Facility installed.

Returned value

If successful, lgamma() returns the above function of its argument.

lgamma() will fail under the following conditions:

  • If the result overflows, the function will return +HUGE_VAL_D32, +HUGE_VAL_D64 or +HUGE_VAL_D128 and set errno to ERANGE.
  • If x is a non-positive integer, lgamma() returns +HUGE_VAL_D32, +HUGE_VAL_D64 or +HUGE_VAL_D128 and sets errno to ERANGE.

Example

CELEBL26

/* CELEBL26

   This exaxmple illustrates the lgammad64() function.

*/

#define __STDC_WANT_DEC_FP__
#include <math.h>
#include <stdio.h>
int main(void)
{
   _Decimal64 x, y;

   x = 42.0DD;
   y = lgammad64(x);

   printf ("lgammad64(%Df) = %Df\n", x, y);
}

Related information