xref: /freebsd/lib/msun/man/lgamma.3 (revision 354fb38542655e3a4f2475b50c6629c51f8d0f33)
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
33354fb385SBruce Evans.\"	$Id: lgamma.3,v 1.5 1997/02/22 15:09:38 peter Exp $
343a8617a8SJordan K. Hubbard.\"
353a8617a8SJordan K. Hubbard.Dd December 3, 1992
363a8617a8SJordan K. Hubbard.Dt LGAMMA 3
373a8617a8SJordan K. Hubbard.Os BSD 4.3
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
443a8617a8SJordan K. Hubbard.Sh SYNOPSIS
453a8617a8SJordan K. Hubbard.Fd #include <math.h>
463a8617a8SJordan K. Hubbard.Ft extern int
473a8617a8SJordan K. Hubbard.Fa signgam ;
483a8617a8SJordan K. Hubbard.sp
493a8617a8SJordan K. Hubbard.Ft double
503a8617a8SJordan K. Hubbard.Fn lgamma "double x"
517a15a32aSJordan K. Hubbard.Ft float
527a15a32aSJordan K. Hubbard.Fn lgammaf "float x"
533a8617a8SJordan K. Hubbard.Ft double
543a8617a8SJordan K. Hubbard.Fn gamma "double x"
557a15a32aSJordan K. Hubbard.Ft float
56354fb385SBruce Evans.Fn gammaf "float x"
573a8617a8SJordan K. Hubbard.Sh DESCRIPTION
587a15a32aSJordan K. Hubbard.Fn lgamma x
597a15a32aSJordan K. Hubbardand
607a15a32aSJordan K. Hubbard.Fn lgammaf x
613a8617a8SJordan K. Hubbard.if t \{\
627a15a32aSJordan K. Hubbardreturn ln\||\(*G(x)| where
633a8617a8SJordan K. Hubbard.Bd -unfilled -offset indent
643a8617a8SJordan 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
653a8617a8SJordan K. Hubbard.br
663a8617a8SJordan K. Hubbard\(*G(x) = \(*p/(\(*G(1\-x)\|sin(\(*px))	for x < 1.
673a8617a8SJordan K. Hubbard.Ed
683a8617a8SJordan K. Hubbard.\}
693a8617a8SJordan K. Hubbard.if n \
70354fb385SBruce Evansreturn ln\||\(*G(x)|.
713a8617a8SJordan K. Hubbard.Pp
723a8617a8SJordan K. HubbardThe external integer
733a8617a8SJordan K. Hubbard.Fa signgam
743a8617a8SJordan K. Hubbardreturns the sign of \(*G(x).
753a8617a8SJordan K. Hubbard.Pp
767a15a32aSJordan K. Hubbard.Fn gamma x
777a15a32aSJordan K. Hubbardand
787a15a32aSJordan K. Hubbard.Fn gammaf x
797a15a32aSJordan K. Hubbardreturn \(*G(x), with no effect on
803a8617a8SJordan K. Hubbard.Fa signgam .
813a8617a8SJordan K. Hubbard.Sh IDIOSYNCRASIES
823a8617a8SJordan K. HubbardDo not use the expression
833a8617a8SJordan K. Hubbard.Dq Li signgam\(**exp(lgamma(x))
843a8617a8SJordan K. Hubbardto compute g := \(*G(x).
853a8617a8SJordan K. HubbardInstead use a program like this (in C):
863a8617a8SJordan K. Hubbard.Bd -literal -offset indent
873a8617a8SJordan K. Hubbardlg = lgamma(x); g = signgam\(**exp(lg);
883a8617a8SJordan K. Hubbard.Ed
893a8617a8SJordan K. Hubbard.Pp
903a8617a8SJordan K. HubbardOnly after
913a8617a8SJordan K. Hubbard.Fn lgamma
927a15a32aSJordan K. Hubbardor
937a15a32aSJordan K. Hubbard.Fn lgammaf
943a8617a8SJordan K. Hubbardhas returned can signgam be correct.
953a8617a8SJordan K. Hubbard.Pp
963a8617a8SJordan K. HubbardFor arguments in its range,
973a8617a8SJordan K. Hubbard.Fn gamma
987a15a32aSJordan K. Hubbardand
997a15a32aSJordan K. Hubbard.Fn gammaf
1003a8617a8SJordan K. Hubbardis preferred, as for positive arguments
1013a8617a8SJordan K. Hubbardit is accurate to within one unit in the last place.
1023a8617a8SJordan K. HubbardExponentiation of
1033a8617a8SJordan K. Hubbard.Fn lgamma
1043a8617a8SJordan K. Hubbardwill lose up to 10 significant bits.
1053a8617a8SJordan K. Hubbard.Sh RETURN VALUES
1067a15a32aSJordan K. Hubbard.Fn gamma ,
1077a15a32aSJordan K. Hubbard.Fn gammaf ,
1087a15a32aSJordan K. Hubbard.Fn lgamma ,
1093a8617a8SJordan K. Hubbardand
1107a15a32aSJordan K. Hubbard.Fn lgammaf
1113a8617a8SJordan K. Hubbardreturn appropriate values unless an argument is out of range.
1123a8617a8SJordan K. HubbardOverflow will occur for sufficiently large positive values, and
1133a8617a8SJordan K. Hubbardnon-positive integers.
1143a8617a8SJordan K. HubbardOn the
1153a8617a8SJordan K. Hubbard.Tn VAX,
1163a8617a8SJordan K. Hubbardthe reserved operator is returned,
1173a8617a8SJordan K. Hubbardand
1183a8617a8SJordan K. Hubbard.Va errno
1193a8617a8SJordan K. Hubbardis set to
1203a8617a8SJordan K. Hubbard.Er ERANGE
1213a8617a8SJordan K. HubbardFor large non-integer negative values,
1223a8617a8SJordan K. Hubbard.Fn gamma
1233a8617a8SJordan K. Hubbardwill underflow.
1243a8617a8SJordan K. Hubbard.Sh SEE ALSO
1254bd9ba3cSMike Pritchard.Xr math 3
1263a8617a8SJordan K. Hubbard.Sh HISTORY
1273a8617a8SJordan K. HubbardThe
1283a8617a8SJordan K. Hubbard.Nm lgamma
1293a8617a8SJordan K. Hubbardfunction appeared in
1303a8617a8SJordan K. Hubbard.Bx 4.3 .
1313a8617a8SJordan K. HubbardThe
1323a8617a8SJordan K. Hubbard.Nm gamma
1333a8617a8SJordan K. Hubbardfunction appeared in
1343a8617a8SJordan K. Hubbard.Bx 4.4 .
1353a8617a8SJordan K. HubbardThe name
1363a8617a8SJordan K. Hubbard.Fn gamma
1373a8617a8SJordan K. Hubbardwas originally dedicated to the
1383a8617a8SJordan K. Hubbard.Fn lgamma
1393a8617a8SJordan K. Hubbardfunction, so some old code may no longer be compatible.
140