/*
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 { __extends } from "tslib";
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
 */
var UltraCalcFunctionBinom_Dist_Range = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(UltraCalcFunctionBinom_Dist_Range, _super);
    function UltraCalcFunctionBinom_Dist_Range() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionBinom_Dist_Range.prototype.evaluate = function (a, b) {
        var c;
        var 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());
        }
        var e = truncate(c._toDecimal2());
        c = a.pop();
        if (c.isError) {
            return new ExcelCalcValue(c.toErrorValue());
        }
        var f = c._toDouble3();
        c = a.pop();
        if (c.isError) {
            return new ExcelCalcValue(c.toErrorValue());
        }
        var g = truncate(c._toDecimal2());
        if (b == 3 || d == e) {
            return UltraCalcFunctionBinomDist._ak(g, f, e, e);
        }
        else {
            return UltraCalcFunctionBinomDist._ak(g, f, e, d);
        }
    };
    UltraCalcFunctionBinom_Dist_Range.prototype.get_name = function () {
        return "binom.dist.range";
    };
    Object.defineProperty(UltraCalcFunctionBinom_Dist_Range.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: false,
        configurable: true
    });
    UltraCalcFunctionBinom_Dist_Range.prototype.get_minArgs = function () {
        return 3;
    };
    Object.defineProperty(UltraCalcFunctionBinom_Dist_Range.prototype, "minArgs", {
        get: function () {
            return this.get_minArgs();
        },
        enumerable: false,
        configurable: true
    });
    UltraCalcFunctionBinom_Dist_Range.prototype.get_maxArgs = function () {
        return 4;
    };
    Object.defineProperty(UltraCalcFunctionBinom_Dist_Range.prototype, "maxArgs", {
        get: function () {
            return this.get_maxArgs();
        },
        enumerable: false,
        configurable: true
    });
    UltraCalcFunctionBinom_Dist_Range.$t = markType(UltraCalcFunctionBinom_Dist_Range, 'UltraCalcFunctionBinom_Dist_Range', BuiltInFunctionBase.$);
    return UltraCalcFunctionBinom_Dist_Range;
}(BuiltInFunctionBase));
export { UltraCalcFunctionBinom_Dist_Range };
