/*
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 { MathUtilities } from "./MathUtilities";
import { markType } from "igniteui-angular-core";
/**
 * @hidden
 */
var UltraCalcFunctionRoundUp = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(UltraCalcFunctionRoundUp, _super);
    function UltraCalcFunctionRoundUp() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionRoundUp.prototype.evaluate = function (a, b) {
        var c = a.pop();
        if (c.isError) {
            return new ExcelCalcValue(c.toErrorValue());
        }
        var d = c._toInt();
        var e = a.pop();
        if (e.isError) {
            return new ExcelCalcValue(e.toErrorValue());
        }
        var f = e._toDouble3();
        var g = f >= 0 ? 1 : -1;
        f = Math.abs(f);
        var h = Math.pow(10, d);
        f *= h;
        f = MathUtilities.i(f);
        f = Math.ceil(f);
        f /= h;
        f *= g;
        f = MathUtilities.i(f);
        if (f == -0) {
            f = 0;
        }
        return new ExcelCalcValue(f);
    };
    UltraCalcFunctionRoundUp.prototype.get_name = function () {
        return "roundup";
    };
    Object.defineProperty(UltraCalcFunctionRoundUp.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: false,
        configurable: true
    });
    UltraCalcFunctionRoundUp.prototype.get_minArgs = function () {
        return 2;
    };
    Object.defineProperty(UltraCalcFunctionRoundUp.prototype, "minArgs", {
        get: function () {
            return this.get_minArgs();
        },
        enumerable: false,
        configurable: true
    });
    UltraCalcFunctionRoundUp.prototype.get_maxArgs = function () {
        return 2;
    };
    Object.defineProperty(UltraCalcFunctionRoundUp.prototype, "maxArgs", {
        get: function () {
            return this.get_maxArgs();
        },
        enumerable: false,
        configurable: true
    });
    UltraCalcFunctionRoundUp.prototype.doesParameterAllowIntermediateResultArray = function (a, b) {
        return true;
    };
    UltraCalcFunctionRoundUp.$t = markType(UltraCalcFunctionRoundUp, 'UltraCalcFunctionRoundUp', BuiltInFunctionBase.$);
    return UltraCalcFunctionRoundUp;
}(BuiltInFunctionBase));
export { UltraCalcFunctionRoundUp };
