cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ] #include <mathcw.h> extern float psilnf (float x); extern double psiln (double x); extern long double psilnl (long double x); extern __float80 psilnw (__float80 x); extern __float128 psilnq (__float128 x); extern long_long_double psilnll (long_long_double x); extern decimal_float psilndf (decimal_float x); extern decimal_double psilnd (decimal_double x); extern decimal_long_double psilndl (decimal_long_double x); extern decimal_long_long_double psilndll (decimal_long_long_double x);
NB: Functions with prototypes containing underscores in type names may be available only with certain extended compilers.
The psi function is the logarithmic derivative of the gamma function:
For positive arguments of even modest size, psi(x) approaches log(x) fairly rapidly, so that psi(x) - log(x) suffers loss of leading significant digits. The psiln(x) function handles the subtraction analytically, avoiding accuracy loss.psi(x) = (d/dx Gamma(x)) / Gamma(x) = d/dx (log Gamma(x))