예제 #1
0
 /**
  * NORMDIST
  *
  * Returns the normal distribution for the specified mean and standard deviation. This
  * function has a very wide range of applications in statistics, including hypothesis
  * testing.
  *
  * @param	float		$value
  * @param	float		$mean		Mean Value
  * @param	float		$stdDev		Standard Deviation
  * @param	boolean		$cumulative
  * @return	float
  *
  */
 public static function NORMDIST($value, $mean, $stdDev, $cumulative)
 {
     $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
     $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
     $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
     if (is_numeric($value) && is_numeric($mean) && is_numeric($stdDev)) {
         if ($stdDev < 0) {
             return PHPExcel_Calculation_Functions::NaN();
         }
         if (is_numeric($cumulative) || is_bool($cumulative)) {
             if ($cumulative) {
                 return 0.5 * (1 + PHPExcel_Calculation_Engineering::_erfVal(($value - $mean) / ($stdDev * sqrt(2))));
             } else {
                 return 1 / (SQRT2PI * $stdDev) * exp(0 - pow($value - $mean, 2) / (2 * ($stdDev * $stdDev)));
             }
         }
     }
     return PHPExcel_Calculation_Functions::VALUE();
 }
예제 #2
0
 public function testGetConversionMultipliers()
 {
     $result = PHPExcel_Calculation_Engineering::getConversionMultipliers();
     $this->assertInternalType('array', $result);
 }