xref: /freebsd/lib/msun/man/lgamma.3 (revision 675902aa7381bf276cab40d5218cab81c43779ed)
13a8617a8SJordan K. Hubbard.\" Copyright (c) 1985, 1991 Regents of the University of California.
23a8617a8SJordan K. Hubbard.\" All rights reserved.
33a8617a8SJordan K. Hubbard.\"
43a8617a8SJordan K. Hubbard.\" Redistribution and use in source and binary forms, with or without
53a8617a8SJordan K. Hubbard.\" modification, are permitted provided that the following conditions
63a8617a8SJordan K. Hubbard.\" are met:
73a8617a8SJordan K. Hubbard.\" 1. Redistributions of source code must retain the above copyright
83a8617a8SJordan K. Hubbard.\"    notice, this list of conditions and the following disclaimer.
93a8617a8SJordan K. Hubbard.\" 2. Redistributions in binary form must reproduce the above copyright
103a8617a8SJordan K. Hubbard.\"    notice, this list of conditions and the following disclaimer in the
113a8617a8SJordan K. Hubbard.\"    documentation and/or other materials provided with the distribution.
123a8617a8SJordan K. Hubbard.\" 3. All advertising materials mentioning features or use of this software
133a8617a8SJordan K. Hubbard.\"    must display the following acknowledgement:
143a8617a8SJordan K. Hubbard.\"	This product includes software developed by the University of
153a8617a8SJordan K. Hubbard.\"	California, Berkeley and its contributors.
163a8617a8SJordan K. Hubbard.\" 4. Neither the name of the University nor the names of its contributors
173a8617a8SJordan K. Hubbard.\"    may be used to endorse or promote products derived from this software
183a8617a8SJordan K. Hubbard.\"    without specific prior written permission.
193a8617a8SJordan K. Hubbard.\"
203a8617a8SJordan K. Hubbard.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
213a8617a8SJordan K. Hubbard.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
223a8617a8SJordan K. Hubbard.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
233a8617a8SJordan K. Hubbard.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
243a8617a8SJordan K. Hubbard.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
253a8617a8SJordan K. Hubbard.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
263a8617a8SJordan K. Hubbard.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
273a8617a8SJordan K. Hubbard.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
283a8617a8SJordan K. Hubbard.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
293a8617a8SJordan K. Hubbard.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
303a8617a8SJordan K. Hubbard.\" SUCH DAMAGE.
313a8617a8SJordan K. Hubbard.\"
323a8617a8SJordan K. Hubbard.\"     from: @(#)lgamma.3	6.6 (Berkeley) 12/3/92
337f3dea24SPeter Wemm.\" $FreeBSD$
343a8617a8SJordan K. Hubbard.\"
353a8617a8SJordan K. Hubbard.Dd December 3, 1992
363a8617a8SJordan K. Hubbard.Dt LGAMMA 3
37a307d598SRuslan Ermilov.Os
383a8617a8SJordan K. Hubbard.Sh NAME
393a8617a8SJordan K. Hubbard.Nm lgamma ,
407a15a32aSJordan K. Hubbard.Nm lgammaf ,
417a15a32aSJordan K. Hubbard.Nm gamma ,
427a15a32aSJordan K. Hubbard.Nm gammaf
437a15a32aSJordan K. Hubbard.Nd log gamma functions, gamma functions
4464890443SBruce Evans.Sh LIBRARY
4564890443SBruce Evans.Lb libm
463a8617a8SJordan K. Hubbard.Sh SYNOPSIS
4732eef9aeSRuslan Ermilov.In math.h
483a8617a8SJordan K. Hubbard.Ft extern int
493a8617a8SJordan K. Hubbard.Fa signgam ;
503a8617a8SJordan K. Hubbard.sp
513a8617a8SJordan K. Hubbard.Ft double
523a8617a8SJordan K. Hubbard.Fn lgamma "double x"
537a15a32aSJordan K. Hubbard.Ft float
547a15a32aSJordan K. Hubbard.Fn lgammaf "float x"
553a8617a8SJordan K. Hubbard.Ft double
563a8617a8SJordan K. Hubbard.Fn gamma "double x"
577a15a32aSJordan K. Hubbard.Ft float
58354fb385SBruce Evans.Fn gammaf "float x"
593a8617a8SJordan K. Hubbard.Sh DESCRIPTION
607a15a32aSJordan K. Hubbard.Fn lgamma x
617a15a32aSJordan K. Hubbardand
627a15a32aSJordan K. Hubbard.Fn lgammaf x
633a8617a8SJordan K. Hubbard.if t \{\
647a15a32aSJordan K. Hubbardreturn ln\||\(*G(x)| where
653a8617a8SJordan K. Hubbard.Bd -unfilled -offset indent
663a8617a8SJordan K. Hubbard\(*G(x) = \(is\d\s8\z0\s10\u\u\s8\(if\s10\d t\u\s8x\-1\s10\d e\u\s8\-t\s10\d dt	for x > 0 and
673a8617a8SJordan K. Hubbard.br
683a8617a8SJordan K. Hubbard\(*G(x) = \(*p/(\(*G(1\-x)\|sin(\(*px))	for x < 1.
693a8617a8SJordan K. Hubbard.Ed
703a8617a8SJordan K. Hubbard.\}
713a8617a8SJordan K. Hubbard.if n \
72354fb385SBruce Evansreturn ln\||\(*G(x)|.
733a8617a8SJordan K. Hubbard.Pp
743a8617a8SJordan K. HubbardThe external integer
753a8617a8SJordan K. Hubbard.Fa signgam
763a8617a8SJordan K. Hubbardreturns the sign of \(*G(x).
773a8617a8SJordan K. Hubbard.Pp
78675902aaSBruce Evans.Fn gamma
797a15a32aSJordan K. Hubbardand
80675902aaSBruce Evans.Fn gammaf
81675902aaSBruce Evansare deprecated aliases for
82675902aaSBruce Evans.Fn lgamma
83675902aaSBruce Evansand
84675902aaSBruce Evans.Fn lgammaf ,
85675902aaSBruce Evansrespectively.
863a8617a8SJordan K. Hubbard.Sh IDIOSYNCRASIES
873a8617a8SJordan K. HubbardDo not use the expression
883a8617a8SJordan K. Hubbard.Dq Li signgam\(**exp(lgamma(x))
893a8617a8SJordan K. Hubbardto compute g := \(*G(x).
903a8617a8SJordan K. HubbardInstead use a program like this (in C):
913a8617a8SJordan K. Hubbard.Bd -literal -offset indent
923a8617a8SJordan K. Hubbardlg = lgamma(x); g = signgam\(**exp(lg);
933a8617a8SJordan K. Hubbard.Ed
943a8617a8SJordan K. Hubbard.Pp
953a8617a8SJordan K. HubbardOnly after
963a8617a8SJordan K. Hubbard.Fn lgamma
977a15a32aSJordan K. Hubbardor
987a15a32aSJordan K. Hubbard.Fn lgammaf
993a8617a8SJordan K. Hubbardhas returned can signgam be correct.
100487d13c0SRuslan Ermilov.\".Pp
101487d13c0SRuslan Ermilov.\"For arguments in its range,
102487d13c0SRuslan Ermilov.\".Fn gamma
103487d13c0SRuslan Ermilov.\"is preferred, as for positive arguments
104487d13c0SRuslan Ermilov.\"it is accurate to within one unit in the last place.
105487d13c0SRuslan Ermilov.\"Exponentiation of
106487d13c0SRuslan Ermilov.\".Fn lgamma
107487d13c0SRuslan Ermilov.\"will lose up to 10 significant bits.
1083a8617a8SJordan K. Hubbard.Sh RETURN VALUES
1097a15a32aSJordan K. Hubbard.Fn gamma ,
1107a15a32aSJordan K. Hubbard.Fn gammaf ,
1117a15a32aSJordan K. Hubbard.Fn lgamma ,
1123a8617a8SJordan K. Hubbardand
1137a15a32aSJordan K. Hubbard.Fn lgammaf
1143a8617a8SJordan K. Hubbardreturn appropriate values unless an argument is out of range.
1153a8617a8SJordan K. HubbardOverflow will occur for sufficiently large positive values, and
1163a8617a8SJordan K. Hubbardnon-positive integers.
1173a8617a8SJordan K. HubbardOn the
1183a8617a8SJordan K. Hubbard.Tn VAX ,
1193a8617a8SJordan K. Hubbardthe reserved operator is returned,
1203a8617a8SJordan K. Hubbardand
1213a8617a8SJordan K. Hubbard.Va errno
1223a8617a8SJordan K. Hubbardis set to
123c23155a4SRuslan Ermilov.Er ERANGE .
124675902aaSBruce Evans\."For large non-integer negative values,
125675902aaSBruce Evans\.".Fn gamma
126675902aaSBruce Evans\."will underflow.
1273a8617a8SJordan K. Hubbard.Sh SEE ALSO
1284bd9ba3cSMike Pritchard.Xr math 3
1293a8617a8SJordan K. Hubbard.Sh HISTORY
1303a8617a8SJordan K. HubbardThe
131563f6bdeSRuslan Ermilov.Fn lgamma
1323a8617a8SJordan K. Hubbardfunction appeared in
1333a8617a8SJordan K. Hubbard.Bx 4.3 .
1343a8617a8SJordan K. HubbardThe
135563f6bdeSRuslan Ermilov.Fn gamma
1363a8617a8SJordan K. Hubbardfunction appeared in
137a9dbc63dSDavid Malone.Bx 4.4
138a9dbc63dSDavid Maloneas a function which computed \(*G(x).
139675902aaSBruce EvansThis version was used in
140675902aaSBruce Evans.Fx 1.1 .
141675902aaSBruce EvansThe name
1423a8617a8SJordan K. Hubbard.Fn gamma
143675902aaSBruce Evanswas originally dedicated to the
144675902aaSBruce Evans.Fn lgamma
145675902aaSBruce Evansfunction,
146675902aaSBruce Evansand that usage was restored by switching to Sun's fdlibm in
147675902aaSBruce Evans.Fx 1.1.5 .
148a9dbc63dSDavid MaloneThe
149a9dbc63dSDavid Malone.St -isoC-99
150a9dbc63dSDavid Malonestandard specifies a function
151a9dbc63dSDavid Malone.Fn tgamma
152a9dbc63dSDavid Malonefor computing \(*G(x).
153675902aaSBruce EvansThis function is currently unimplemented in this library.
154