if (a instanceof ExprMissing)
return;
if (a instanceof ExprString) {
if (strict)
throw new ExprException("Unexpected argument for AVERAGE: " + a);
else
return;
}
if (a instanceof ExprDouble || a instanceof ExprInteger) {
double d = ((ExprNumber) a).doubleValue();
values[0] += Math.pow(average - d, 2);
values[1] += 1;
return;
}
if (a instanceof ExprArray) {
ExprArray arr = (ExprArray) a;
int rows = arr.rows();
int cols = arr.columns();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
eval(arr.get(i, j), average, values, false);
}
}
return;
}
throw new ExprException("Unexpected argument for STDEV: " + a);
}