/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { BuiltInFunctionBase } from "./BuiltInFunctionBase";
import { ExcelCalcValue } from "./ExcelCalcValue";
import { markType } from "igniteui-angular-core";
/**
 * @hidden
 */
export class UltraCalcFunctionSeriesSum extends BuiltInFunctionBase {
    evaluate(a, b) {
        let c = this._getArguments(a, b - 3, true);
        c.reverse();
        let d = a.pop();
        if (d.isError) {
            return new ExcelCalcValue(d.toErrorValue());
        }
        let e = d._toInt();
        d = a.pop();
        if (d.isError) {
            return new ExcelCalcValue(d.toErrorValue());
        }
        let f = d._toInt();
        d = a.pop();
        if (d.isError) {
            return new ExcelCalcValue(d.toErrorValue());
        }
        let g = d._toDouble3();
        let h = f;
        let i = 0;
        for (let k = 0; k < c.length; k++) {
            let j = c[k];
            if (j.isError) {
                return new ExcelCalcValue(j.toErrorValue());
            }
            let l = j._toDouble3();
            let m = l * Math.pow(g, h);
            i += m;
            h += e;
        }
        return new ExcelCalcValue(i);
    }
    canParameterBeEnumerable(a) {
        return a == 3;
    }
    get_name() {
        return "seriessum";
    }
    get name() {
        return this.get_name();
    }
    get_minArgs() {
        return 4;
    }
    get minArgs() {
        return this.get_minArgs();
    }
    get_maxArgs() {
        return 4;
    }
    get maxArgs() {
        return this.get_maxArgs();
    }
    doesParameterAllowIntermediateResultArray(a, b) {
        return (b == false);
    }
}
UltraCalcFunctionSeriesSum.$t = markType(UltraCalcFunctionSeriesSum, 'UltraCalcFunctionSeriesSum', BuiltInFunctionBase.$);
//# sourceMappingURL=UltraCalcFunctionSeriesSum.js.map