public static function PHPExcel_Calculation_Statistical::DEVSQ in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php \PHPExcel_Calculation_Statistical::DEVSQ()
* DEVSQ * * Returns the sum of squares of deviations of data points from their sample mean. * * Excel Function: * DEVSQ(value1[,value2[, ...]]) * * @access public * @category Statistical Functions *
Parameters
mixed $arg,... Data values: * @return float
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Statistical.php, line 1434
Class
- PHPExcel_Calculation_Statistical
- PHPExcel_Calculation_Statistical
Code
public static function DEVSQ() {
$aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
// Return value
$returnValue = null;
$aMean = self::AVERAGE($aArgs);
if ($aMean != PHPExcel_Calculation_Functions::DIV0()) {
$aCount = -1;
foreach ($aArgs as $k => $arg) {
// Is it a numeric value?
if (is_bool($arg) && (!PHPExcel_Calculation_Functions::isCellValue($k) || PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE)) {
$arg = (int) $arg;
}
if (is_numeric($arg) && !is_string($arg)) {
if (is_null($returnValue)) {
$returnValue = pow($arg - $aMean, 2);
}
else {
$returnValue += pow($arg - $aMean, 2);
}
++$aCount;
}
}
// Return
if (is_null($returnValue)) {
return PHPExcel_Calculation_Functions::NaN();
}
else {
return $returnValue;
}
}
return self::NA();
}