Compute the gamma function of a number
Synopsis:
#include <math.h>
double tgamma( double x );
float tgammaf( float x );
long double tgammal( long double x );
Arguments:
 x
 An arbitrary number.
Library:
libm
Use the l m option to
qcc
to link against this library.
Description:
The tgamma(), tgammaf(), and tgammal() functions
compute Γ(x), which is defined as follows:
To check for error situations, use
feclearexcept()
and
fetestexcept():
 Call feclearexcept(FE_ALL_EXCEPT) before calling
tgamma(), tgammaf(), or tgammal().
 On return, if fetestexcept(FE_INVALID  FE_DIVBYZERO  FE_OVERFLOW  FE_UNDERFLOW)
is nonzero, then an error has occurred.
Returns:
The gamma of x.
 If x is a negative integer, a domain error may occur and a NaN is returned.
 If x is ±0, these functions return ±HUGE_VAL,
±HUGE_VALF, and ±HUGE_VALL, respectively.
A pole error may occur.
 If the correct value would cause an overflow, a range error occurs and these functions return ±HUGE_VAL,
±HUGE_VALF, and ±HUGE_VALL, respectively,
with the same sign as the correct value of the function.
 If the correct value would cause underflow, and isn't representable, a range error may occur,
and these functions return 0.0, or (if IEC 60559 FloatingPoint isn't supported) an implementationdefined
value no greater in magnitude than DBL_MIN, FLT_MIN, and LDBL_MIN,
respectively.
 If the correct value would cause underflow, and is representable, a range error may occur,
and the correct value is returned.
 If x is subnormal and 1 / x is representable,
1 / x is returned.
 If x is NaN, a NaN is returned.
 If x is +Inf, x is returned.
 If x is Inf, a domain error occurs, and a NaN is returned.
Errors:
 FE_DIVBYZERO
 The x argument is 0.
 FE_INVALID
 The value of x argument is a negative integer, or x is Inf.
 FE_OVERFLOW
 The result would cause an overflow.
 FE_UNDERFLOW
 The value of x isn't equal to y,
and the correct function value is subnormal, zero, or underflows.
Classification:
ANSI,
POSIX 1003.1
Safety: 

Cancellation point 
No 
Interrupt handler 
No 
Signal handler 
No 
Thread 
Yes 