tgamma, tgammaf, tgammal

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at tgamma, tgammaf, tgammal.

Determines the gamma function of the specified value.

Syntax

double tgamma(  
   double x  
);  
  
float tgamma(  
   float x  
); //C++ only  
  
long double tgamma(  
   long double x  
); //C++ only  
  
float tgammaf(  
   float x  
);  
  
long double tgammal(  
   long double x  
);  
  

Parameters

[in] x
The value to find the gamma of.

Return Value

If successful, returns the gamma of x.

A range error may occur if the magnitude of x is too large or too small for the data type. A domain error or range error may occur if x <=0.

Issue Return
x = ±0 ±INFINITY
x = negative integer NaN
x = -INFINITY NaN
x = +INFINITY +INFINITY
x = NaN NaN
domain error NaN
pole error ±HUGE_VAL, ±HUGE_VALF, or ±HUGE_VALL
overflow range error ±HUGE_VAL, ±HUGE_VALF, or ±HUGE_VALL
underflow range error the correct value, after rounding.

Errors are reported as specified in _matherr.

Remarks

Because C++ allows overloading, you can call overloads of tgamma that take and return float and long double types. In a C program, tgamma always takes and returns a double.

If x is a natural number, this function returns the factorial of (x-1).

Requirements

Function C header C++ header
tgamma, tgammaf, tgammal <math.h> <cmath>

For additional compatibility information, see Compatibility.

See Also

Alphabetical Function Reference
lgamma, lgammaf, lgammal