Annotation of 43BSDReno/lib/libm/common_source/lgamma.3, revision 1.1

1.1     ! root        1: .\" Copyright (c) 1985 Regents of the University of California.
        !             2: .\" All rights reserved.  The Berkeley software License Agreement
        !             3: .\" specifies the terms and conditions for redistribution.
        !             4: .\"
        !             5: .\"    @(#)lgamma.3    6.2 (Berkeley) 5/12/86
        !             6: .\"
        !             7: .TH LGAMMA 3M  "May 12, 1986"
        !             8: .UC 6
        !             9: .SH NAME
        !            10: lgamma \- log gamma function
        !            11: .SH SYNOPSIS
        !            12: .nf
        !            13: .B #include <math.h>
        !            14: .PP
        !            15: .B double lgamma(x)
        !            16: .B double x;
        !            17: .fi
        !            18: .SH DESCRIPTION
        !            19: .nf
        !            20: .ta \w'Lgamma returns ln\||\(*G(x)| where'u+1n +1.7i
        !            21: .if t \{\
        !            22: Lgamma returns ln\||\(*G(x)| where     \(*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
        !            23: .br
        !            24:        \(*G(x) = \(*p/(\(*G(1\-x)\|sin(\(*px)) for x < 1.  \}
        !            25: .if n \
        !            26: Lgamma returns ln\||\(*G(x)|.
        !            27: .ta
        !            28: .fi
        !            29: .PP
        !            30: The external integer signgam returns the sign of
        !            31: \(*G(x) .
        !            32: .SH IDIOSYNCRASIES
        !            33: Do \fBnot\fR use the expression signgam\(**exp(lgamma(x))
        !            34: to compute g := \(*G(x).  Instead use a program like this (in C):
        !            35: .RS
        !            36: lg = lgamma(x); g = signgam\(**exp(lg);
        !            37: .RE
        !            38: .PP
        !            39: Only after lgamma has returned can signgam be correct.
        !            40: Note too that \(*G(x) must overflow when x is large enough,
        !            41: underflow when \-x is large enough, and spawn a division by zero
        !            42: when x is a nonpositive integer.
        !            43: .PP
        !            44: Only in the UNIX math library for C was the name gamma ever attached
        !            45: to ln\(*G.  Elsewhere, for instance in IBM's FORTRAN library, the name
        !            46: GAMMA belongs to \(*G and the name ALGAMA to ln\(*G in single precision;
        !            47: in double the names are DGAMMA and DLGAMA.  Why should C be different?
        !            48: .PP
        !            49: Archaeological records suggest that C's gamma originally delivered
        !            50: ln(\(*G(|x|)).  Later, the program gamma was changed to
        !            51: cope with negative arguments x in a more conventional way, but
        !            52: the documentation did not reflect that change correctly.  The most
        !            53: recent change corrects inaccurate values when x is almost a
        !            54: negative integer, and lets \(*G(x) be computed without
        !            55: conditional expressions.  Programmers should not assume that
        !            56: lgamma has settled down.
        !            57: .PP
        !            58: At some time in the future, the name \fIgamma\fR will be rehabilitated
        !            59: and used for the gamma function, just as is done in FORTRAN.
        !            60: The reason for this is not so much compatibility with FORTRAN as a
        !            61: desire to achieve greater speed for smaller values of |x| and greater
        !            62: accuracy for larger values.
        !            63: .PP
        !            64: Meanwhile, programmers who have to use the name \fIgamma\fR in its former
        !            65: sense, for what is now \fIlgamma\fR, have two choices:
        !            66: .IP 1) \w'1)\0'u
        !            67: Use the old math library, \fIlibom\fR.
        !            68: .IP 2) \w'1)\0'u
        !            69: Add the following program to your others:
        !            70: .RS
        !            71: .nf
        !            72: \fB#include <math.h>
        !            73: double gamma(x)
        !            74: double x;
        !            75: {
        !            76: .RS
        !            77: \fBreturn (lgamma(x));
        !            78: .RE
        !            79: }\fR
        !            80: .RE
        !            81: .fi
        !            82: .SH DIAGNOSTICS
        !            83: The reserved operand is returned on a VAX for negative integer arguments,
        !            84: \fIerrno\fR is set to ERANGE; for very large arguments over/underflows will
        !            85: occur inside the \fIlgamma\fP routine.
        !            86: .SH SEE ALSO
        !            87: math(3M), infnan(3M)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.