コード例 #1
0
ファイル: Functions.php プロジェクト: hostellerie/nexpro
 /**
  * GEOMEAN
  *
  * Returns the geometric mean of an array or range of positive data. For example, you
  * can use GEOMEAN to calculate average growth rate given compound interest with
  * variable rates.
  *
  * @param	array of mixed		Data Series
  * @return  float
  */
 public static function GEOMEAN()
 {
     $aMean = PHPExcel_Calculation_Functions::PRODUCT(func_get_args());
     if (is_numeric($aMean) && $aMean > 0) {
         $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
         $aCount = PHPExcel_Calculation_Functions::COUNT($aArgs);
         if (PHPExcel_Calculation_Functions::MIN($aArgs) > 0) {
             return pow($aMean, 1 / $aCount);
         }
     }
     return self::$_errorCodes['num'];
 }