double[] asArray(Expr vals) throws ExprException {
if (vals instanceof ExprInteger || vals instanceof ExprDouble) {
return new double[] { ((ExprNumber) vals).doubleValue() };
} else if (vals instanceof ExprArray) {
ExprArray a = (ExprArray) vals;
double[] arr = new double[a.length()];
int index = 0;
for (int i = 0; i < arr.length; i++) {
Expr e = evalArg(a.get(i));
if (e instanceof ExprNumber) {
arr[index++] = ((ExprNumber) e).doubleValue();
}
}
if (arr.length == index)