LGAMMA(3) BSD Programmer's Manual LGAMMA(3)[top]NAMElgamma, lgammaf, gamma, gammaf, lgamma_r, lgammaf_r, gamma_r,gammaf_rlog gamma functions, gamma functions-SYNOPSIS#include <math.h> extern int signgam; double lgamma(double x); float lgammaf(float x); double gamma(double x); float gammaf(float x); double lgamma_r(double x, int *sign); float lgammaf_r(float x, int *sign); double gamma_r(double x, int *sign); float gammaf_r(float x, int *sign);DESCRIPTION_ lgamma(x) and lgammaf(x) return ln|| (x)|. _ The external integer signgam returns the sign of | (x). _ gamma(x) and gammaf(x) return | (x), with no effect on signgam. The functions lgamma_r(), lgammaf_r(), gamma_r() and gammaf_r() are iden- tical to the versions without the _r suffixes, but instead of setting the global variable signgam, they store the sign indirectly through their sign argument. This avoids any races between asynchronous threads to set a global variable like signgam.IDIOSYNCRASIESD_ not use the expression ``signgam*exp(lgamma(x))'' to compute g := | (x). Instead use a program like this (in C): lg = lgamma(x); g = signgam*exp(lg); Only after lgamma() or lgammaf() has returned can signgam be correct. For arguments in its range, gamma() and gammaf() is preferred, as for positive arguments it can be more accurate. Exponentiation of lgamma() may lose several significant bits.ERRORSIf the result would overflow, then: _IEEE_ The return value is +Inf. _POSIX_ Same as _IEEE_, but errno is also set to ERANGE. _XOPEN_ Same as _POSIX_, but errno is only set if matherr(3) returns 0. The exception type is OVERFLOW. _SVID_ Same as _XOPEN_, but the return value is MAXFLOAT. If x is a nonpositive integer value, then: _IEEE_ The return value is +Inf. _POSIX_ Same as _IEEE_, but errno is also set to EDOM. _XOPEN_ Same as _POSIX_, but errno is only set if matherr(3) returns 0. The exception type is SING. _SVID_ Same as _XOPEN_, but the return value is MAXFLOAT, and a mes- sage is printed to stderr if errno is set.SEE ALSOmath(3)HISTORYThe lgamma function appeared in 4.3BSD. The gamma function appeared in 4.4BSD. The name gamma() was originally dedicated to the lgamma() func- tion, so some old code may no longer be compatible.4.3 Berkeley Distribution February 17, 1998 2

List of man pages available for

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]

Polar

Member of Polar

Based on Fawad Halim's script.

....................................................................

Vote for polarhome |