Commit 10ee1e0a authored by GoshaZotov's avatar GoshaZotov

add RRI formula

parent d0907c4c
......@@ -58,7 +58,7 @@
cFormulaFunctionGroup['Statistical'].push(cBINOM_DIST_RANGE, cF_TEST, cFORECAST_ETS, cFORECAST_ETS_CONFINT,
cFORECAST_ETS_SEASONALITY, cFORECAST_ETS_STAT, cHYPGEOM_DIST);
cFormulaFunctionGroup['Financial'] = cFormulaFunctionGroup['Financial'] || [];
cFormulaFunctionGroup['Financial'].push(cPDURATION, cRRI);
cFormulaFunctionGroup['Financial'].push(cPDURATION);
cFormulaFunctionGroup['Mathematic'] = cFormulaFunctionGroup['Mathematic'] || [];
cFormulaFunctionGroup['Mathematic'].push(cAGGREGATE, cMUNIT);
cFormulaFunctionGroup['LookupAndReference'] = cFormulaFunctionGroup['LookupAndReference'] || [];
......@@ -70,7 +70,7 @@
cFormulaFunctionGroup['NotRealised'].push(cDAYS, cISOWEEKNUM, cBITAND, cBITLSHIFT, cBITOR, cBITRSHIFT, cBITXOR,
cDBCS, cUNICHAR, cUNICODE, cBINOM_DIST_RANGE, cF_TEST, cFORECAST_ETS, cFORECAST_ETS_CONFINT,
cFORECAST_ETS_SEASONALITY, cFORECAST_ETS_STAT, cHYPGEOM_DIST, cPDURATION,
cRRI, cAGGREGATE, cMUNIT, cFORMULATEXT, cISFORMULA, cSHEET, cSHEETS);
cAGGREGATE, cMUNIT, cFORMULATEXT, cISFORMULA, cSHEET, cSHEETS);
/**
* @constructor
......@@ -348,18 +348,6 @@
cQUERYSTRING.prototype = Object.create(cBaseFunction.prototype);
cQUERYSTRING.prototype.constructor = cQUERYSTRING;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cRRI() {
cBaseFunction.call(this, "RRI");
this.isXLFN = true;
}
cRRI.prototype = Object.create(cBaseFunction.prototype);
cRRI.prototype.constructor = cRRI;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......
......@@ -459,7 +459,7 @@
cCOUPDAYSNC, cCOUPNCD, cCOUPNUM, cCOUPPCD, cCUMIPMT, cCUMPRINC, cDB, cDDB, cDISC, cDOLLARDE, cDOLLARFR,
cDURATION, cEFFECT, cFV, cFVSCHEDULE, cINTRATE, cIPMT, cIRR, cISPMT, cMDURATION, cMIRR, cNOMINAL, cNPER, cNPV,
cODDFPRICE, cODDFYIELD, cODDLPRICE, cODDLYIELD, cPMT, cPPMT, cPRICE, cPRICEDISC, cPRICEMAT, cPV, cRATE,
cRECEIVED, cSLN, cSYD, cTBILLEQ, cTBILLPRICE, cTBILLYIELD, cVDB, cXIRR, cXNPV, cYIELD, cYIELDDISC, cYIELDMAT);
cRECEIVED, cRRI, cSLN, cSYD, cTBILLEQ, cTBILLPRICE, cTBILLYIELD, cVDB, cXIRR, cXNPV, cYIELD, cYIELDDISC, cYIELDMAT);
/**
* @constructor
......@@ -4681,6 +4681,49 @@
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cRRI() {
this.name = "RRI";
this.value = null;
this.argumentsCurrent = 0;
}
cRRI.prototype = Object.create(cBaseFunction.prototype);
cRRI.prototype.constructor = cRRI;
cRRI.prototype.argumentsMin = 3;
cRRI.prototype.argumentsMax = 3;
cRRI.prototype.isXLFN = true;
cRRI.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
argClone[0] = argClone[0].tocNumber();
argClone[1] = argClone[1].tocNumber();
argClone[2] = argClone[2].tocNumber();
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
var calcrpi = function(argArray){
var arg0 = argArray[0];
var arg1 = argArray[1];
var arg2 = argArray[2];
if ( arg0 <= 0.0 || arg1 === 0.0 ){
return new cError(cErrorType.not_numeric);
}
return new cNumber(Math.pow(arg2 / arg1, 1.0 / arg0) - 1.0);
};
return this.value = this._findArrayInNumberArguments(oArguments, calcrpi);
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment