Commit 81f73586 authored by GoshaZotov's avatar GoshaZotov

add PERMUTATIONA formula

parent 91a3aee0
......@@ -4416,6 +4416,15 @@ $( function () {
strictEqual( oParser.calculate().getValue(), 0.583, "PERCENTRANK.INC(A202:A211, 5)" );
} );
test( "Test: \"PERMUTATIONA\"", function () {
oParser = new parserFormula( "PERMUTATIONA(3,2)", "A1", ws );
ok( oParser.parse(), "PERMUTATIONA(3,2)" );
strictEqual( oParser.calculate().getValue(), 9, "PERMUTATIONA(3,2)" );
oParser = new parserFormula( "PERMUTATIONA(2,2)", "A1", ws );
ok( oParser.parse(), "PERMUTATIONA(2,2)" );
strictEqual( oParser.calculate().getValue(), 4, "PERMUTATIONA(2,2)" );
} );
test( "Test: \"POISSON\"", function () {
......
......@@ -56,7 +56,7 @@
cFormulaFunctionGroup['TextAndData'].push(cDBCS, cUNICHAR, cUNICODE);
cFormulaFunctionGroup['Statistical'] = cFormulaFunctionGroup['Statistical'] || [];
cFormulaFunctionGroup['Statistical'].push(cBINOM_DIST_RANGE, cF_TEST, cFORECAST_ETS, cFORECAST_ETS_CONFINT,
cFORECAST_ETS_SEASONALITY, cFORECAST_ETS_STAT, cHYPGEOM_DIST, cPERMUTATIONA, cPHI);
cFORECAST_ETS_SEASONALITY, cFORECAST_ETS_STAT, cHYPGEOM_DIST, cPHI);
cFormulaFunctionGroup['Financial'] = cFormulaFunctionGroup['Financial'] || [];
cFormulaFunctionGroup['Financial'].push(cPDURATION, cRRI);
cFormulaFunctionGroup['Mathematic'] = cFormulaFunctionGroup['Mathematic'] || [];
......@@ -69,7 +69,7 @@
cFormulaFunctionGroup['NotRealised'] = cFormulaFunctionGroup['NotRealised'] || [];
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, cPERMUTATIONA, cPHI, cPDURATION,
cFORECAST_ETS_SEASONALITY, cFORECAST_ETS_STAT, cHYPGEOM_DIST, cPHI, cPDURATION,
cRRI, cAGGREGATE, cMUNIT, cFORMULATEXT, cISFORMULA, cSHEET, cSHEETS);
/**
......@@ -336,18 +336,6 @@
cPDURATION.prototype = Object.create(cBaseFunction.prototype);
cPDURATION.prototype.constructor = cPDURATION;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cPERMUTATIONA() {
cBaseFunction.call(this, "PERMUTATIONA");
this.isXLFN = true;
}
cPERMUTATIONA.prototype = Object.create(cBaseFunction.prototype);
cPERMUTATIONA.prototype.constructor = cPERMUTATIONA;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......
......@@ -70,7 +70,7 @@
cLOGEST, cLOGINV, cLOGNORM_DIST, cLOGNORM_INV, cLOGNORMDIST, cMAX, cMAXA, cMEDIAN, cMIN, cMINA, cMODE,
cMODE_MULT, cMODE_SNGL, cNEGBINOMDIST, cNEGBINOM_DIST, cNORMDIST, cNORM_DIST, cNORMINV, cNORM_INV, cNORMSDIST,
cNORM_S_DIST, cNORMSINV, cNORM_S_INV, cPEARSON, cPERCENTILE, cPERCENTILE_EXC, cPERCENTILE_INC, cPERCENTRANK,
cPERCENTRANK_EXC, cPERCENTRANK_INC, cPERMUT, cPOISSON, cPOISSON_DIST, cPROB, cQUARTILE, cQUARTILE_EXC,
cPERCENTRANK_EXC, cPERCENTRANK_INC, cPERMUT, cPERMUTATIONA, cPOISSON, cPOISSON_DIST, cPROB, cQUARTILE, cQUARTILE_EXC,
cQUARTILE_INC, cRANK, cRANK_AVG, cRANK_EQ, cRSQ, cSKEW, cSKEW_P, cSLOPE, cSMALL, cSTANDARDIZE, cSTDEV, cSTDEV_S,
cSTDEVA, cSTDEVP, cSTDEV_P, cSTDEVPA, cSTEYX, cTDIST, cT_DIST, cT_DIST_2T, cT_DIST_RT, cT_INV, cT_INV_2T, cTINV,
cTREND, cTRIMMEAN, cTTEST, cT_TEST, cVAR, cVARA, cVARP, cVAR_P, cVAR_S, cVARPA, cWEIBULL, cWEIBULL_DIST, cZTEST,
......@@ -6150,6 +6150,48 @@
return this.value = new cNumber(Math.permut(arg0.getValue(), arg1.getValue()));
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cPERMUTATIONA() {
this.name = "PERMUTATIONA";
this.value = null;
this.argumentsCurrent = 0;
}
cPERMUTATIONA.prototype = Object.create(cBaseFunction.prototype);
cPERMUTATIONA.prototype.constructor = cQUARTILE;
cPERMUTATIONA.prototype.argumentsMin = 2;
cPERMUTATIONA.prototype.argumentsMax = 2;
cPERMUTATIONA.prototype.isXLFN = true;
cPERMUTATIONA.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();
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
function permutationa(argArray) {
var n = Math.floor(argArray[0]);
var k = Math.floor(argArray[1]);
if (n < 0.0 || k < 0.0){
return new cError(cErrorType.not_numeric);
}
return new cNumber(Math.pow(n,k));
}
return this.value = this._findArrayInNumberArguments(oArguments, permutationa);
};
/**
* @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