xref: /freebsd/lib/msun/man/lgamma.3 (revision 64890443c1b144b289df30a5123d179955bc8c92)
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
787a15a32aSJordan K. Hubbard.Fn gamma x
797a15a32aSJordan K. Hubbardand
807a15a32aSJordan K. Hubbard.Fn gammaf x
817a15a32aSJordan K. Hubbardreturn \(*G(x), with no effect on
823a8617a8SJordan K. Hubbard.Fa signgam .
833a8617a8SJordan K. Hubbard.Sh IDIOSYNCRASIES
843a8617a8SJordan K. HubbardDo not use the expression
853a8617a8SJordan K. Hubbard.Dq Li signgam\(**exp(lgamma(x))
863a8617a8SJordan K. Hubbardto compute g := \(*G(x).
873a8617a8SJordan K. HubbardInstead use a program like this (in C):
883a8617a8SJordan K. Hubbard.Bd -literal -offset indent
893a8617a8SJordan K. Hubbardlg = lgamma(x); g = signgam\(**exp(lg);
903a8617a8SJordan K. Hubbard.Ed
913a8617a8SJordan K. Hubbard.Pp
923a8617a8SJordan K. HubbardOnly after
933a8617a8SJordan K. Hubbard.Fn lgamma
947a15a32aSJordan K. Hubbardor
957a15a32aSJordan K. Hubbard.Fn lgammaf
963a8617a8SJordan K. Hubbardhas returned can signgam be correct.
973a8617a8SJordan K. Hubbard.Pp
983a8617a8SJordan K. HubbardFor arguments in its range,
993a8617a8SJordan K. Hubbard.Fn gamma
1007a15a32aSJordan K. Hubbardand
1017a15a32aSJordan K. Hubbard.Fn gammaf
1023a8617a8SJordan K. Hubbardis preferred, as for positive arguments
1033a8617a8SJordan K. Hubbardit is accurate to within one unit in the last place.
1043a8617a8SJordan K. HubbardExponentiation of
1053a8617a8SJordan K. Hubbard.Fn lgamma
1063a8617a8SJordan K. Hubbardwill lose up to 10 significant bits.
1073a8617a8SJordan K. Hubbard.Sh RETURN VALUES
1087a15a32aSJordan K. Hubbard.Fn gamma ,
1097a15a32aSJordan K. Hubbard.Fn gammaf ,
1107a15a32aSJordan K. Hubbard.Fn lgamma ,
1113a8617a8SJordan K. Hubbardand
1127a15a32aSJordan K. Hubbard.Fn lgammaf
1133a8617a8SJordan K. Hubbardreturn appropriate values unless an argument is out of range.
1143a8617a8SJordan K. HubbardOverflow will occur for sufficiently large positive values, and
1153a8617a8SJordan K. Hubbardnon-positive integers.
1163a8617a8SJordan K. HubbardOn the
1173a8617a8SJordan K. Hubbard.Tn VAX ,
1183a8617a8SJordan K. Hubbardthe reserved operator is returned,
1193a8617a8SJordan K. Hubbardand
1203a8617a8SJordan K. Hubbard.Va errno
1213a8617a8SJordan K. Hubbardis set to
122c23155a4SRuslan Ermilov.Er ERANGE .
1233a8617a8SJordan K. HubbardFor large non-integer negative values,
1243a8617a8SJordan K. Hubbard.Fn gamma
1253a8617a8SJordan K. Hubbardwill underflow.
1263a8617a8SJordan K. Hubbard.Sh SEE ALSO
1274bd9ba3cSMike Pritchard.Xr math 3
1283a8617a8SJordan K. Hubbard.Sh HISTORY
1293a8617a8SJordan K. HubbardThe
130563f6bdeSRuslan Ermilov.Fn lgamma
1313a8617a8SJordan K. Hubbardfunction appeared in
1323a8617a8SJordan K. Hubbard.Bx 4.3 .
1333a8617a8SJordan K. HubbardThe
134563f6bdeSRuslan Ermilov.Fn gamma
1353a8617a8SJordan K. Hubbardfunction appeared in
1363a8617a8SJordan K. Hubbard.Bx 4.4 .
1373a8617a8SJordan K. HubbardThe name
1383a8617a8SJordan K. Hubbard.Fn gamma
1393a8617a8SJordan K. Hubbardwas originally dedicated to the
1403a8617a8SJordan K. Hubbard.Fn lgamma
1413a8617a8SJordan K. Hubbardfunction, so some old code may no longer be compatible.
142