tgamma, tgammaf, tgammal, tgammad32, tgammad64, and tgammad128 Subroutines

The tgamma, tgammaf, tgammal, tgammad32, tgammad64, and tgammad128 subroutines compute the gamma function of x.

An application wishing to check for error situations should set errno to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these subroutines. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.

Purpose

Computes the gamma.

Syntax

#include <math.h>

double tgamma (x)
double x;

float tgammaf (x)
float x;

long double tgammal (x)
long double x;
_Decimal32 tgammad32 (x)
_Decimal32 x;

_Decimal64 tgammad64 (x)
_Decimal64 x;

_Decimal128 tgammad128 (x)
_Decimal128 x;

Description

Parameters

Item Description
x Specifies the value to be computed.

Return Values

Upon successful completion, the tgamma, tgammaf, tgammal, tgammad32, tgammad64, and tgammad128 subroutines return Gamma(x).

If x is a negative integer, a domain error occurs, and either a NaN (if supported), or an implementation-defined value is returned.

If the correct value would cause overflow, a range error occurs and the tgamma, tgammaf, tgammal, tgammad32, tgammad64, and tgammad128 subroutines return the value of the macro HUGE_VAL, HUGE_VALF, HUGE_VALL, HUGE_VAL_D32, HUGE_VAL_D64, or HUGE_VAL_D128 respectively.

If x is NaN, a NaN is returned.

If x is +Inf, x is returned.

If x is ±0, a pole error occurs, and the tgamma, tgammaf, tgammal, tgammad32, tgammad64, and tgammad128 subroutines return ±HUGE_VAL, ±HUGE_VALF, ±HUGE_VALL, ±HUGE_VAL_D32, ±HUGE_VAL_D64, or ±HUGE_VAL_D128 respectively.

If x is -Inf, a domain error occurs, and either a NaN (if supported), or an implementation-defined value is returned.