clustal-omega-1.2.4/src/squid/sre_math.c
/* Function: Gammln()
 *
 * Returns the natural log of the gamma function of x.
 * x is > 0.0.  
 *
 * Adapted from a public domain implementation in the
 * NCBI core math library. Thanks to John Spouge and
 * the NCBI. (According to the NCBI, that's Dr. John
 * "Gammas Galore" Spouge to you, pal.)
 */
Gammln()

Returns the natural log of the gamma function of x.

Adapted from a public domain implementation in the
NCBI core math library. Thanks to John Spouge and
the NCBI. (According to the NCBI, that's Dr. John
"Gammas Galore" Spouge to you, pal.)
Gammln () Returns the natural log of the gamma function of x . Adapted from a public domain implementation in the NCBI core math library . Thanks to John Spouge and the NCBI . ( According to the NCBI that ' s Dr . John " Gammas Galore " Spouge to you pal . )
double
Gammln(double x)
{
  int i;
  double xx, tx;
  double tmp, value;
  static double cof[11] = {
    4.694580336184385e+04,
    -1.560605207784446e+05,
    2.065049568014106e+05,
    -1.388934775095388e+05,
    5.031796415085709e+04,
    -9.601592329182778e+03,
    8.785855930895250e+02,
    -3.155153906098611e+01,
    2.908143421162229e-01,
    -2.319827630494973e-04,
    1.251639670050933e-10
  };
  if (x <= 0.0) return 999999.; 
  xx       = x - 1.0;
  tx = tmp = xx + 11.0;
  value    = 1.0;
  for (i = 10; i >= 0; i--)	
    {
      value += cof[i] / tmp;
      tmp   -= 1.0;
    }
  value  = log(value);
  tx    += 0.5;
  value += 0.918938533 + (xx+0.5)*log(tx) - tx;
  return value;
}
double Gammln ( double x ) { int i ; double xx , tx ; double tmp , value ; static double cof [ 11 ] = { 4.694580336184385e+04 , -1.560605207784446e+05 , 2.065049568014106e+05 , -1.388934775095388e+05 , 5.031796415085709e+04 , -9.601592329182778e+03 , 8.785855930895250e+02 , -3.155153906098611e+01 , 2.908143421162229e-01 , -2.319827630494973e-04 , 1.251639670050933e-10 } ; if ( x <= 0.0 ) return 999999. ; xx = x - 1.0 ; tx = tmp = xx + 11.0 ; value = 1.0 ; for ( i = 10 ; i >= 0 ; i -- ) { value += cof [ i ] / tmp ; tmp -= 1.0 ; } value = log ( value ) ; tx += 0.5 ; value += 0.918938533 + ( xx + 0.5 ) * log ( tx ) - tx ; return value ; }
Function: Gammln()
Function : Gammln ()
/* Protect against x=0. We see this in Dirichlet code,
   * for terms alpha = 0. This is a severe hack but it is effective
   * and (we think?) safe. (due to GJM)
   */ /* sum least significant terms first */