#include <lcmath.h> double gamma(double x);
gamma
computes the logarithm of the gamma function of its argument
x
. The value returned by gamma
is defined by this
equation:
gamma
returns the logarithm of the gamma function of its argument.
stderr
) if x
is a negative number or 0. In this case, the
function returns HUGE_VAL
, the largest positive floating-point number that
can be represented. Also, the run-time library writes an error message to the
standard error file (stderr
) if x
is greater than
0.42686124520937873e74 in scientific notation. In this case, the function returns
HUGE_VAL
, the largest positive floating-point number that can be
represented.
If an error occurs in gamma
, the _matherr
routine is called.
You can supply your own version of _matherr
to suppress the diagnostic
message or modify the value returned.
gamma
is portable to many, but not all, non UNIX C implementations.
gamma
:
#include <stdio.h> #include <lcmath.h> #define SVECTOR .7854 main() { double lgamv; lgamv = gamma(SVECTOR); printf("gamma(%f) = %fn", SVECTOR, lgamv); }
_matherr
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.