/*
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 { UltraCalcFunctionBinomDist } from "./UltraCalcFunctionBinomDist";
import { markType } from "igniteui-angular-core";
import { truncate } from "igniteui-angular-core";
/**
 * @hidden
 */
export let UltraCalcFunctionBinom_Dist_Range = /*@__PURE__*/ (() => {
    class UltraCalcFunctionBinom_Dist_Range extends BuiltInFunctionBase {
        evaluate(a, b) {
            let c;
            let d = 0;
            if (b == 4) {
                c = a.pop();
                if (c.isError) {
                    return new ExcelCalcValue(c.toErrorValue());
                }
                d = truncate(c._toDecimal2());
            }
            c = a.pop();
            if (c.isError) {
                return new ExcelCalcValue(c.toErrorValue());
            }
            let e = truncate(c._toDecimal2());
            c = a.pop();
            if (c.isError) {
                return new ExcelCalcValue(c.toErrorValue());
            }
            let f = c._toDouble3();
            c = a.pop();
            if (c.isError) {
                return new ExcelCalcValue(c.toErrorValue());
            }
            let g = truncate(c._toDecimal2());
            if (b == 3 || d == e) {
                return UltraCalcFunctionBinomDist._ak(g, f, e, e);
            }
            else {
                return UltraCalcFunctionBinomDist._ak(g, f, e, d);
            }
        }
        get_name() {
            return "binom.dist.range";
        }
        get name() {
            return this.get_name();
        }
        get_minArgs() {
            return 3;
        }
        get minArgs() {
            return this.get_minArgs();
        }
        get_maxArgs() {
            return 4;
        }
        get maxArgs() {
            return this.get_maxArgs();
        }
    }
    UltraCalcFunctionBinom_Dist_Range.$t = markType(UltraCalcFunctionBinom_Dist_Range, 'UltraCalcFunctionBinom_Dist_Range', BuiltInFunctionBase.$);
    return UltraCalcFunctionBinom_Dist_Range;
})();
