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 81a9dbc63dSDavid Malonereturn ln\||\(*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. 97a9dbc63dSDavid Malone.\.Pp 98a9dbc63dSDavid Malone.\For arguments in its range, 99a9dbc63dSDavid Malone.\.Fn gamma 100a9dbc63dSDavid Malone.\and 101a9dbc63dSDavid Malone.\.Fn gammaf 102a9dbc63dSDavid Malone.\is preferred, as for positive arguments 103a9dbc63dSDavid Malone.\it is accurate to within one unit in the last place. 104a9dbc63dSDavid Malone.\Exponentiation of 105a9dbc63dSDavid Malone.\.Fn lgamma 106a9dbc63dSDavid Malone.\will 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 136a9dbc63dSDavid Malone.Bx 4.4 137a9dbc63dSDavid Maloneas a function which computed \(*G(x). 138a9dbc63dSDavid MaloneIn many older libraries the function 1393a8617a8SJordan K. Hubbard.Fn gamma 140a9dbc63dSDavid Malonecalculated the same value as 141a9dbc63dSDavid Malone.Fn lgamma . 142a9dbc63dSDavid MaloneNow 143a9dbc63dSDavid Malone.Fn gamma 144a9dbc63dSDavid Malonecomputes ln\||\(*G(x)|, 145a9dbc63dSDavid Malonebut it uses a different algorithm, 146a9dbc63dSDavid Maloneand it does not set 147a9dbc63dSDavid Malone.Fa signgam . 148a9dbc63dSDavid MaloneThe 149a9dbc63dSDavid Malone.St -isoC-99 150a9dbc63dSDavid Malonestandard specifies a function 151a9dbc63dSDavid Malone.Fn tgamma 152a9dbc63dSDavid Malonefor computing \(*G(x). 153a9dbc63dSDavid MaloneThis function is currently unimplimented in this library. 154