lgamma man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



GAMMA(3M)							     GAMMA(3M)

NAME
     lgamma, gamma, lgammal, gammal - log gamma function

SYNOPSIS
     #include <math.h>

     double gamma(double x);
     double lgamma(double x);
     long double gammal(long double x);
     long double lgammal(long double x);

     extern int signgam;
     extern int signgaml;

DESCRIPTION
     lgamma and gamma return ln|(GAMMA(x))|, where GAMMA is the
     mathematical gamma function.

     gammal and lgammal are the long double versions of the log gamma
     function.

     gamma and lgamma are identical, as are gammal and lgammal.

     The external integer signgam returns the sign of GAMMA(x), and the
     external integer signgaml returns the sign of GAMMAL(x).

IDIOSYNCRASIES
     Do not use the expression signgam*exp(gamma(x)) to compute g := GAMMA(x).
     Instead use a program like this (in C):
	  lg = gamma(x); g = signgam*exp(lg);

     Only after gamma has returned can signgam be correct.  Note too that
     GAMMA(x) must overflow when x is large enough, and is undefined when x is
     a nonpositive integer.

     Analogous rules apply to gammal and signgaml.

     The following C program fragment might be used to calculate G if the
     overflow needs to be detected:
	   if ((y = gamma(x)) > LN_MAXDOUBLE)
		   error();
	   y = signgam * exp(y);

     where LN_MAXDOUBLE is the least value that causes exp(3M) to overflow and
     is defined in the <values.h> header file.

     Only in the UNIX math library for C was the name gamma ever attached to
     ln G.   Elsewhere (in some FORTRAN libraries) the name GAMMA belongs to G
     and the name ALGAMMA to ln G in single precision;	in double the usual
     names are DGAMMA and DLGAMMA in FORTRAN.  Why should C be different?

									Page 1

GAMMA(3M)							     GAMMA(3M)

     Archeological records suggest that C's gamma originally delivered	ln(G
     (x)).  Later, the program gamma was changed to cope with negative
     arguments in a more conventional way, but the documentation did not
     reflect that change correctly.  The most recent change corrects
     inaccurate values when x is almost a negative integer.

     Some math libraries have changed the name of this function to lgamma() to
     suggest its real functionality.
     On SGI systems, the name gamma is currently maintained as a synonym to
     lgamma for compatibility.	It may disappear in a future release.

NOTES
     lgamma and gamma are not ANSI-C functions.	 If you compile with flag
     -ansi or -ansiposix, you must supply your own prototypes for these
     functions or you will get incorrect results. (See the prototypes defined
     in /usr/include/math.h)

DIAGNOSTICS
     In the diagnostics below, functions in the standard math library libm.a,
     are referred to as -lm versions, those in math library libmx.a are
     referred to as -lmx versions, and those in the the BSD math library
     libm43.a are referred to as -lm43 versions.  The -lm and -lmx versions
     always return the default Quiet NaN and set errno to EDOM when a NaN is
     used as an argument.  A NaN argument usually causes the -lm43 versions to
     return the same argument.	The -lm43 versions never set errno.  The value
     of HUGE_VAL is IEEE Infinity.

     The gamma functions return HUGE_VAL when the argument is zero or a
     negative integer. The -lm and -lmx versions also set errno to EDOM.
     When the correct value would overflow, the gamma functions return
     HUGE_VAL. The -lm and -lmx versions also set errno to ERANGE.

     See matherr(3M) for a description of error handling for -lmx functions.

SEE ALSO
     math(3M), matherr(3M)

									Page 2

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net