File: lgamma.3

package info (click to toggle)
manpages 3.05-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 10,852 kB
  • ctags: 10
  • sloc: sh: 389; perl: 164; makefile: 80; lisp: 22
file content (123 lines) | stat: -rw-r--r-- 2,710 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
.\" Distributed under GPL
.\" based on glibc infopages
.\"
.TH LGAMMA 3 2007-07-26 "" "Linux Programmer's Manual"
.SH NAME
lgamma, lgammaf, lgammal, lgamma_r, lgammaf_r, lgammal_r, signgam \-
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 );
.sp
.BI "extern int " signgam ;
.fi
.sp
Link with \fI\-lm\fP.
.sp
.in -4n
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.sp
.ad l
.BR lgamma (),
.BR lgammaf (),
.BR lgammal ():
_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE; or
.I cc\ -std=c99
.br
.BR lgamma_r (),
.BR lgammaf_r (),
.BR lgammal_r ():
_BSD_SOURCE || _SVID_SOURCE
.br
.IR signgam :
_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE
.ad b
.SH DESCRIPTION
For the definition of the Gamma function, see
.BR tgamma (3).
.PP
The
.BR lgamma ()
function returns the natural logarithm of
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
been introduced; they return this sign via the argument
.IR signp .
.PP
For non-positive integer values of \fIx\fP,
.BR lgamma ()
returns
.BR HUGE_VAL ,
sets \fIerrno\fP to
.B ERANGE
and raises the zero divide exception.
(Similarly,
.BR lgammaf ()
returns
.B HUGE_VALF
and
.BR lgammal ()
returns
.BR HUGE_VALL .)
.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
.I x
is too large.
A pole error occurs if
.I x
is a negative integer or zero.
.SH "CONFORMING TO"
The
.BR lgamma ()
functions are specified in C99 and POSIX.1-2001.
.I signgam
is specified in POSIX.1-2001, but not in C99.
The
.BR lgamma_r ()
functions are non-standard, but present on several other systems.
.SH "SEE ALSO"
.BR tgamma (3)
.SH COLOPHON
This page is part of release 3.05 of the Linux
.I man-pages
project.
A description of the project,
and information about reporting bugs,
can be found at
http://www.kernel.org/doc/man-pages/.