You are here

private static function PHPExcel_Calculation_Statistical::_gamma in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php \PHPExcel_Calculation_Statistical::_gamma()
3 calls to PHPExcel_Calculation_Statistical::_gamma()
PHPExcel_Calculation_Statistical::CHIDIST in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php
* CHIDIST * * Returns the one-tailed probability of the chi-squared distribution. * *
PHPExcel_Calculation_Statistical::GAMMADIST in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php
* GAMMADIST * * Returns the gamma distribution. * *
PHPExcel_Calculation_Statistical::GAMMALN in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php
* GAMMALN * * Returns the natural logarithm of the gamma function. * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php, line 442

Class

PHPExcel_Calculation_Statistical
PHPExcel_Calculation_Statistical

Code

private static function _gamma($data) {
  if ($data == 0.0) {
    return 0;
  }
  static $p0 = 1.000000000190015;
  static $p = array(
    1 => 76.18009172947146,
    2 => -86.50532032941678,
    3 => 24.01409824083091,
    4 => -1.231739572450155,
    5 => 0.001208650973866179,
    6 => -5.395239384953E-6,
  );
  $y = $x = $data;
  $tmp = $x + 5.5;
  $tmp -= ($x + 0.5) * log($tmp);
  $summer = $p0;
  for ($j = 1; $j <= 6; ++$j) {
    $summer += $p[$j] / ++$y;
  }
  return exp(0 - $tmp + log(SQRT2PI * $summer / $x));
}