You are here

public static function PHPExcel_Calculation_Statistical::EXPONDIST 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::EXPONDIST()

* EXPONDIST * * Returns the exponential distribution. Use EXPONDIST to model the time between events, * such as how long an automated bank teller takes to deliver cash. For example, you can * use EXPONDIST to determine the probability that the process takes at most 1 minute. * *

Parameters

float $value Value of the function: * @param float $lambda The parameter value * @param boolean $cumulative * @return float

File

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

Class

PHPExcel_Calculation_Statistical
PHPExcel_Calculation_Statistical

Code

public static function EXPONDIST($value, $lambda, $cumulative) {
  $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
  $lambda = PHPExcel_Calculation_Functions::flattenSingleValue($lambda);
  $cumulative = PHPExcel_Calculation_Functions::flattenSingleValue($cumulative);
  if (is_numeric($value) && is_numeric($lambda)) {
    if ($value < 0 || $lambda < 0) {
      return PHPExcel_Calculation_Functions::NaN();
    }
    if (is_numeric($cumulative) || is_bool($cumulative)) {
      if ($cumulative) {
        return 1 - exp(0 - $value * $lambda);
      }
      else {
        return $lambda * exp(0 - $value * $lambda);
      }
    }
  }
  return PHPExcel_Calculation_Functions::VALUE();
}