/*
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 { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { CalcDateUtilities } from "./CalcDateUtilities";
import { MathUtilities } from "./MathUtilities";
import { markType } from "igniteui-angular-core";
/**
 * @hidden
 */
export class UltraCalcFunctionYearFrac extends BuiltInFunctionBase {
    evaluate(a, b) {
        let c = b == 3 ? a.pop() : null;
        let d = a.pop();
        let e = a.pop();
        let f, g;
        if (!((() => { let h = e._aj(a._w, f, false, true); f = h.p1; return h.ret; })())) {
            return new ExcelCalcValue(new ExcelCalcErrorValue(4));
        }
        if (!((() => { let h = d._aj(a._w, g, false, true); g = h.p1; return h.ret; })())) {
            return new ExcelCalcValue(new ExcelCalcErrorValue(4));
        }
        let h = c == null ? 0 : c._toInt321();
        if (h < 0 || h > 4) {
            return new ExcelCalcValue(new ExcelCalcErrorValue(4));
        }
        let i = CalcDateUtilities.d(f, g, h);
        return new ExcelCalcValue(MathUtilities.i(i));
    }
    get_maxArgs() {
        return 3;
    }
    get maxArgs() {
        return this.get_maxArgs();
    }
    get_minArgs() {
        return 2;
    }
    get minArgs() {
        return this.get_minArgs();
    }
    get_name() {
        return "yearfrac";
    }
    get name() {
        return this.get_name();
    }
}
UltraCalcFunctionYearFrac.$t = markType(UltraCalcFunctionYearFrac, 'UltraCalcFunctionYearFrac', BuiltInFunctionBase.$);
//# sourceMappingURL=UltraCalcFunctionYearFrac.js.map