1993-03-21 12:45:37 +03:00
|
|
|
.\" Copyright (c) 1985, 1991 Regents of the University of California.
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the University of
|
|
|
|
.\" California, Berkeley and its contributors.
|
|
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1993-08-14 17:42:09 +04:00
|
|
|
.\" from: @(#)lgamma.3 6.6 (Berkeley) 12/3/92
|
2002-02-20 14:52:39 +03:00
|
|
|
.\" $NetBSD: lgamma.3,v 1.19 2002/02/20 11:52:39 wiz Exp $
|
1993-03-21 12:45:37 +03:00
|
|
|
.\"
|
1993-08-14 17:42:09 +04:00
|
|
|
.Dd December 3, 1992
|
1993-03-21 12:45:37 +03:00
|
|
|
.Dt LGAMMA 3
|
1999-03-22 22:44:33 +03:00
|
|
|
.Os
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh NAME
|
1997-11-12 03:47:32 +03:00
|
|
|
.Nm lgamma ,
|
1999-08-16 02:23:53 +04:00
|
|
|
.Nm lgammaf ,
|
1999-08-16 16:35:18 +04:00
|
|
|
.Nm lgamma_r ,
|
|
|
|
.Nm lgammaf_r ,
|
1999-08-16 02:23:53 +04:00
|
|
|
.Nm gamma ,
|
1999-08-16 16:35:18 +04:00
|
|
|
.Nm gammaf ,
|
|
|
|
.Nm gamma_r ,
|
|
|
|
.Nm gammaf_r
|
1995-04-14 22:39:53 +04:00
|
|
|
.Nd log gamma function
|
1998-02-05 21:45:17 +03:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libm
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh SYNOPSIS
|
2002-02-07 10:00:09 +03:00
|
|
|
.Fd #include \*[Lt]math.h\*[Gt]
|
1993-08-14 17:42:09 +04:00
|
|
|
.Ft extern int
|
|
|
|
.Fa signgam ;
|
|
|
|
.sp
|
1993-03-21 12:45:37 +03:00
|
|
|
.Ft double
|
|
|
|
.Fn lgamma "double x"
|
1995-04-14 22:39:53 +04:00
|
|
|
.Ft float
|
|
|
|
.Fn lgammaf "float x"
|
1999-08-16 02:23:53 +04:00
|
|
|
.Ft double
|
1999-08-16 16:35:18 +04:00
|
|
|
.Fn lgamma_r "double x" "int *sign"
|
|
|
|
.Ft float
|
|
|
|
.Fn lgammaf_r "float x" "int *sign"
|
|
|
|
.Ft double
|
1999-08-16 02:23:53 +04:00
|
|
|
.Fn gamma "double x"
|
|
|
|
.Ft float
|
|
|
|
.Fn gammaf "float x"
|
1999-08-16 16:35:18 +04:00
|
|
|
.Ft double
|
|
|
|
.Fn gamma_r "double x" "int *sign"
|
|
|
|
.Ft float
|
|
|
|
.Fn gammaf_r "float x" "int *sign"
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh DESCRIPTION
|
1998-08-29 12:32:32 +04:00
|
|
|
.Fn lgamma x
|
1993-03-21 12:45:37 +03:00
|
|
|
.if t \{\
|
1993-08-14 17:42:09 +04:00
|
|
|
returns ln\||\(*G(x)| where
|
1993-03-21 12:45:37 +03:00
|
|
|
.Bd -unfilled -offset indent
|
2002-02-07 10:00:09 +03:00
|
|
|
\(*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 \*[Gt] 0 and
|
1993-03-21 12:45:37 +03:00
|
|
|
.br
|
2002-02-07 10:00:09 +03:00
|
|
|
\(*G(x) = \(*p/(\(*G(1\-x)\|sin(\(*px)) for x \*[Lt] 1.
|
1993-03-21 12:45:37 +03:00
|
|
|
.Ed
|
1993-08-14 17:42:09 +04:00
|
|
|
.\}
|
1993-03-21 12:45:37 +03:00
|
|
|
.if n \
|
1993-08-14 17:42:09 +04:00
|
|
|
returns ln\||\(*G(x)|.
|
1993-03-21 12:45:37 +03:00
|
|
|
.Pp
|
|
|
|
The external integer
|
|
|
|
.Fa signgam
|
1993-08-14 17:42:09 +04:00
|
|
|
returns the sign of \(*G(x).
|
|
|
|
.Pp
|
1999-08-16 16:35:18 +04:00
|
|
|
.Fn lgamma_r
|
|
|
|
is a reentrant interface that performs identically to
|
|
|
|
.Fn lgamma ,
|
|
|
|
differing in that the sign of \(*G(x) is stored in the location
|
|
|
|
pointed to by the
|
|
|
|
.Fa sign
|
|
|
|
argument and
|
|
|
|
.Fa signgam
|
|
|
|
is not modified.
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh IDIOSYNCRASIES
|
1993-08-14 17:42:09 +04:00
|
|
|
Do not use the expression
|
1993-03-21 12:45:37 +03:00
|
|
|
.Dq Li signgam\(**exp(lgamma(x))
|
1993-08-14 17:42:09 +04:00
|
|
|
to compute g := \(*G(x).
|
|
|
|
Instead use a program like this (in C):
|
1993-03-21 12:45:37 +03:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
lg = lgamma(x); g = signgam\(**exp(lg);
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Only after
|
|
|
|
.Fn lgamma
|
|
|
|
has returned can signgam be correct.
|
1993-08-14 17:42:09 +04:00
|
|
|
.Sh RETURN VALUES
|
1998-08-29 12:32:32 +04:00
|
|
|
.Fn lgamma
|
1997-07-26 00:41:18 +04:00
|
|
|
returns appropriate values unless an argument is out of range.
|
1993-08-14 17:42:09 +04:00
|
|
|
Overflow will occur for sufficiently large positive values, and
|
|
|
|
non-positive integers.
|
|
|
|
On the
|
2002-02-20 14:52:39 +03:00
|
|
|
.Tn VAX ,
|
1993-08-14 17:42:09 +04:00
|
|
|
the reserved operator is returned,
|
|
|
|
and
|
1993-03-21 12:45:37 +03:00
|
|
|
.Va errno
|
|
|
|
is set to
|
1997-07-26 00:41:18 +04:00
|
|
|
.Er ERANGE .
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh SEE ALSO
|
1996-03-30 04:33:59 +03:00
|
|
|
.Xr math 3
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
1993-08-14 17:42:09 +04:00
|
|
|
.Nm lgamma
|
1999-07-02 19:37:33 +04:00
|
|
|
function appeared in
|
1993-03-21 12:45:37 +03:00
|
|
|
.Bx 4.3 .
|