title | description | ms.date | api_name | api_location | api_type | topic_type | f1_keywords | helpviewer_keywords | ms.assetid | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
lgamma, lgammaf, lgammal |
API reference for lgamma, lgammaf, and lgammal; which determines the natural logarithm of the absolute value of the gamma function of the specified value. |
9/1/2020 |
|
|
|
|
|
|
6e326c58-7077-481a-a329-c82ae56ae9e6 |
Determines the natural logarithm of the absolute value of the gamma function of the specified value.
double lgamma( double x );
float lgammaf( float x );
long double lgammal( long double x );
#define lgammal(X) // Requires C11 or higher
float lgamma( float x ); //C++ only
long double lgamma( long double x ); //C++ only
x
The value to compute.
If successful, return the natural logarithm of the absolute value of the gamma function of x
.
Issue | Return |
---|---|
x = NaN |
NaN |
x = ±0 |
+INFINITY |
x = negative integer |
+INFINITY |
±INFINITY | +INFINITY |
pole error | +HUGE_VAL , +HUGE_VALF , or +HUGE_VALL |
overflow range error | ±HUGE_VAL , ±HUGE_VALF , or ±HUGE_VALL |
Errors are reported as specified in _matherr
.
Because C++ allows overloading, you can call overloads of lgamma
that take and return float
and long double
types. In a C program, unless you're using the <tgmath.h> macro to call this function, lgamma
always takes and returns a double
.
If you use the <tgmath.h> lgamma()
macro, the type of the argument determines which version of the function is selected. See Type-generic math for details.
If x is a rational number, this function returns the logarithm of the factorial of (x - 1).
By default, this function's global state is scoped to the application. To change this behavior, see Global state in the CRT.
Function | C header | C++ header |
---|---|---|
lgamma , lgammaf , lgammal |
<math.h> | <cmath> |
lgamma macro |
<tgmath.h> |
For more compatibility information, see Compatibility.