GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
LGAMMA(3) FreeBSD Library Functions Manual LGAMMA(3)

lgamma, lgamma_r, lgammaf, lgammaf_r, lgammal, lgammal_r, gamma, gamma_r, gammaf, gammaf_r, tgamma, tgammaf, tgammal, — log gamma functions, gamma function

Math Library (libm, -lm)

#include <math.h>

extern int signgam;


double
lgamma(double x);

double
lgamma_r(double x, int *signgamp);

float
lgammaf(float x);

float
lgammaf_r(float x, int *signgamp);

long double
lgammal(long double x);

long double
lgammal_r(long double x, int *signgamp);

double
gamma(double x);

double
gamma_r(double x, int *signgamp);

float
gammaf(float x);

float
gammaf_r(float x, int *signgamp);

long double
tgamma(double x);

float
tgammaf(float x);

long double
tgammal(long double x);

(x), (x), and (x) return ln|Γ(x)|. The external integer signgam returns the sign of Γ(x).

(x, signgamp), (x, signgamp), and (x, signgamp) provide the same functionality as lgamma(x), lgammaf(x), and lgammal(x), but the caller must provide an integer to store the sign of Γ(x).

The (x), (x), and (x) functions return Γ(x), with no effect on signgam.

(), (), (), and () are deprecated aliases for lgamma(), lgammaf(), lgamma_r(), and lgammaf_r(), respectively.

Do 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 () or () has returned can signgam be correct.

For arguments in its range, () is preferred, as for positive arguments it is accurate to within one unit in the last place. Exponentiation of lgamma() will lose up to 10 significant bits.

gamma(), gammaf(), gammal(), gamma_r(), gammaf_r(), gammal_r(), lgamma(), lgammaf(), lgammal(), lgamma_r(), lgammaf_r(), and lgammal_r() return appropriate values unless an argument is out of range. Overflow will occur for sufficiently large positive values, and non-positive integers. For large non-integer negative values, tgamma() will underflow.

math(3)

The lgamma(), lgammaf(), lgammal(), tgamma(), tgammaf(), and tgammal() functions are expected to conform to ISO/IEC 9899:1999 (“ISO C99”).

The lgamma() function appeared in 4.3BSD. The gamma() function appeared in 4.4BSD as a function which computed Γ(x). This version was used in FreeBSD 1.1. The name gamma() was originally dedicated to the lgamma() function, and that usage was restored by switching to Sun's fdlibm in FreeBSD 1.1.5. The tgamma() function appeared in FreeBSD 5.0. The 128-bit long double version of tgammal() replaced the 80-bit stub version in version in FreeBSD 14.1, thanks to an appropriate implementation from Arm.

April 12, 2024 FreeBSD 14.3-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.