/*
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 { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { ErfUtils } from "./ErfUtils";
import { markType } from "igniteui-angular-core";
/**
 * @hidden
 */
export let UltraCalcFunctionErf = /*@__PURE__*/ (() => {
    class UltraCalcFunctionErf extends BuiltInFunctionBase {
        evaluate(a, b) {
            let c = 0;
            let d = null;
            if (b == 2) {
                d = a.pop();
            }
            let e = a.pop();
            if (e.isError) {
                return new ExcelCalcValue(e.toErrorValue());
            }
            else if (e.isBoolean) {
                return new ExcelCalcValue(new ExcelCalcErrorValue(1));
            }
            if (b == 2) {
                if (d.isError) {
                    return new ExcelCalcValue(d.toErrorValue());
                }
                else if (d.isBoolean) {
                    return new ExcelCalcValue(new ExcelCalcErrorValue(1));
                }
                c = d._toDouble3();
            }
            let f = e._toDouble3();
            let g = ErfUtils.c(f);
            if (b == 2) {
                g = ErfUtils.c(c) - g;
            }
            return new ExcelCalcValue(g);
        }
        get_name() {
            return "erf";
        }
        get name() {
            return this.get_name();
        }
        get_minArgs() {
            return 1;
        }
        get minArgs() {
            return this.get_minArgs();
        }
        get_maxArgs() {
            return 2;
        }
        get maxArgs() {
            return this.get_maxArgs();
        }
    }
    UltraCalcFunctionErf.$t = markType(UltraCalcFunctionErf, 'UltraCalcFunctionErf', BuiltInFunctionBase.$);
    return UltraCalcFunctionErf;
})();
