man-pages/man3/lgamma.3

81 lines
1.9 KiB
Groff
Raw Normal View History

2004-11-03 13:51:07 +00:00
.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
.\" Distributed under GPL
.\" based on glibc infopages
.\"
.TH LGAMMA 3 2002-08-10 "" "Linux Programmer's Manual"
.SH NAME
lgamma, lgammaf, lgammal, lgamma_r, lgammaf_r, lgammal_r \- log gamma function
.SH SYNOPSIS
.nf
.B #include <math.h>
.sp
.BI "double lgamma(double " x );
.br
.BI "float lgammaf(float " x );
.br
.BI "long double lgammal(long double " x );
.sp
.BI "double lgamma_r(double " x ", int *" signp );
.br
.BI "float lgammaf_r(float " x ", int *" signp );
.br
.BI "long double lgammal_r(long double " x ", int *" signp );
.fi
.sp
Compile with \fI\-std=c99\fP; link with \fI\-lm\fP.
2004-11-03 13:51:07 +00:00
.SH DESCRIPTION
For the definition of the Gamma function, see
.BR tgamma (3).
.PP
The
.BR lgamma ()
function returns the natural logarithm of
2004-11-03 13:51:07 +00:00
the absolute value of the Gamma function.
The sign of the Gamma function is returned in the
external integer \fIsigngam\fP declared in
.IR <math.h> .
It is 1 when the Gamma function is positive or zero, \-1
when it is negative.
.PP
Since using a constant location
.I signgam
is not thread-safe, the functions
.BR lgamma_r ()
etc. have
2004-11-03 13:51:07 +00:00
been introduced; they return this sign via the parameter
.IR signp .
.PP
For non-positive integer values of \fIx\fP,
.BR lgamma ()
2007-06-22 19:42:52 +00:00
returns
.BR HUGE_VAL ,
2007-06-22 18:09:13 +00:00
sets \fIerrno\fP to
.B ERANGE
and raises the zero divide exception.
(Similarly,
.BR lgammaf ()
2007-06-22 19:42:52 +00:00
returns
.B HUGE_VALF
and
.BR lgammal ()
returns
2007-06-22 19:42:52 +00:00
.BR HUGE_VALL .)
2004-11-03 13:51:07 +00:00
.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
2004-11-03 13:51:07 +00:00
.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 a negative integer or zero.
.SH "CONFORMING TO"
2006-08-03 13:57:30 +00:00
C99, SVr4, 4.3BSD
2004-11-03 13:51:07 +00:00
.SH "SEE ALSO"
.BR tgamma (3)