tgamma, tgammaf, tgammal

Visual Studio 2015
 

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.

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.

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.

IssueReturn
x = ±0±INFINITY
x = negative integerNaN
x = -INFINITYNaN
x = +INFINITY+INFINITY
x = NaNNaN
domain errorNaN
pole error±HUGE_VAL, ±HUGE_VALF, or ±HUGE_VALL
overflow range error±HUGE_VAL, ±HUGE_VALF, or ±HUGE_VALL
underflow range errorthe correct value, after rounding.

Errors are reported as specified in _matherr.

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).

FunctionC headerC++ header
tgamma, tgammaf, tgammal<math.h><cmath>

For additional compatibility information, see Compatibility.

Alphabetical Function Reference
lgamma, lgammaf, lgammal

Show: