/*
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 { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { markType } from "igniteui-angular-core";
/**
 * @hidden
 */
var UltraCalcFunctionPV = /** @class */ (function (_super) {
    tslib_1.__extends(UltraCalcFunctionPV, _super);
    function UltraCalcFunctionPV() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionPV.prototype.evaluate = function (a, b) {
        var c = 0;
        if (b == 5) {
            c = a.pop()._toInt321();
        }
        var d = 0;
        if (b >= 4 && !((function () { var e = a.pop()._toDouble1(d); d = e.p0; return e.ret; })())) {
            return new ExcelCalcValue(new ExcelCalcErrorValue(4));
        }
        var e, f, g;
        if (!((function () { var h = a.pop()._toDouble1(e); e = h.p0; return h.ret; })()) || !((function () { var h = a.pop()._toDouble1(f); f = h.p0; return h.ret; })()) || !((function () { var h = a.pop()._toDouble1(g); g = h.p0; return h.ret; })())) {
            return new ExcelCalcValue(new ExcelCalcErrorValue(4));
        }
        if (c != 0) {
            e *= 1 + g;
        }
        return new ExcelCalcValue((e * (1 - Math.pow(1 + g, -f)) / g + (d / Math.pow(1 + g, f))) * -1);
    };
    UltraCalcFunctionPV.prototype.get_name = function () {
        return "pv";
    };
    Object.defineProperty(UltraCalcFunctionPV.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionPV.prototype.get_minArgs = function () {
        return 3;
    };
    Object.defineProperty(UltraCalcFunctionPV.prototype, "minArgs", {
        get: function () {
            return this.get_minArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionPV.prototype.get_maxArgs = function () {
        return 5;
    };
    Object.defineProperty(UltraCalcFunctionPV.prototype, "maxArgs", {
        get: function () {
            return this.get_maxArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionPV.$t = markType(UltraCalcFunctionPV, 'UltraCalcFunctionPV', BuiltInFunctionBase.$);
    return UltraCalcFunctionPV;
}(BuiltInFunctionBase));
export { UltraCalcFunctionPV };
//# sourceMappingURL=UltraCalcFunctionPV.js.map