mirror of https://github.com/mkerrisk/man-pages
59 lines
1.5 KiB
Groff
59 lines
1.5 KiB
Groff
|
.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
|
||
|
.\" Distributed under GPL
|
||
|
.\" Based on glibc infopages
|
||
|
.TH TGAMMA 3 2002-08-10 "GNU" "libc math functions"
|
||
|
.SH NAME
|
||
|
tgamma, tgammaf, tgammal \- true gamma function
|
||
|
.SH SYNOPSIS
|
||
|
.B #include <math.h>
|
||
|
.sp
|
||
|
.BI "double tgamma(double " x );
|
||
|
.br
|
||
|
.BI "float tgammaf(float " x );
|
||
|
.br
|
||
|
.BI "long double tgammal(long double " x );
|
||
|
.sp
|
||
|
Link with \-lm.
|
||
|
.SH DESCRIPTION
|
||
|
The Gamma function is defined by
|
||
|
.sp
|
||
|
Gamma(x) = integral from 0 to infinity of t^(x-1) e^-t dt
|
||
|
.sp
|
||
|
It is defined for every real number except for nonpositive integers.
|
||
|
For nonnegative integral \fIm\fP one has
|
||
|
.sp
|
||
|
Gamma(m+1) = m!
|
||
|
.sp
|
||
|
and, more generally, for all \fIx\fP:
|
||
|
.sp
|
||
|
Gamma(x+1) = x * Gamma(x)
|
||
|
.sp
|
||
|
For \fIx\fP < 0.5 one can use
|
||
|
.sp
|
||
|
Gamma(x) * Gamma(1-x) = PI/sin(PI*x)
|
||
|
.PP
|
||
|
This function returns the value of the Gamma function for the
|
||
|
argument \fIx\fP. It had to be called "true gamma function"
|
||
|
since there is already a function
|
||
|
.I gamma()
|
||
|
that returns something else.
|
||
|
.SH ERRORS
|
||
|
In order to check for errors, set
|
||
|
.I errno
|
||
|
to zero and call
|
||
|
.I feclearexcept(FE_ALL_EXCEPT)
|
||
|
before calling these functions. On return, if
|
||
|
.I errno
|
||
|
is non-zero or
|
||
|
.I fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
|
||
|
is non-zero, an error has occurred.
|
||
|
.LP
|
||
|
A range error occurs if x is too large.
|
||
|
A pole error occurs if x is zero.
|
||
|
A domain error (or a pole error) occurs if x is a negative integer.
|
||
|
.SH "CONFORMING TO"
|
||
|
C99.
|
||
|
.SH "SEE ALSO"
|
||
|
.BR gamma (3),
|
||
|
.BR lgamma (3)
|