Calculates the gamma function of the argument.
Include
<math.h>
Prototype
float tgammaf(float x);
Argument
x
Return Value
Calculates the gamma function of the argument.
Remarks
A domain error occurs if x
is negative or if the result
cannot be represented with x
is zero. A range error might occur if the
value of x
is too large or too small.
Example
#include <math.h>
#include <stdio.h>
#include <errno.h>
int main(void)
{
float x, y;
x = 0.5;
y = tgammaf(x);
if(errno)
perror("Error");
printf("The gamma function of %f is %f\n", x, y);
x = -0.75;
y = tgammaf(x);
if(errno)
perror("Error");
printf("The gamma function of %f is %f\n", x, y);
}
Example Output
The gamma function of 0.500000 is 1.772454
The gamma function of -0.750000 is -4.834147