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