Commit ab5ae9a2 authored by GoshaZotov's avatar GoshaZotov

add LOGNORM.INV formula

parent 4e9597f2
...@@ -1068,6 +1068,16 @@ $( function () { ...@@ -1068,6 +1068,16 @@ $( function () {
strictEqual( oParser.calculate().getValue().toFixed(7) - 0, 0.0176176, "LOGNORM.DIST(A2,A3,A4,FALSE)" ); strictEqual( oParser.calculate().getValue().toFixed(7) - 0, 0.0176176, "LOGNORM.DIST(A2,A3,A4,FALSE)" );
} ); } );
test( "Test: \"LOGNORM.INV\"", function () {
ws.getRange2( "A2" ).setValue( "0.039084" );
ws.getRange2( "A3" ).setValue( "3.5" );
ws.getRange2( "A4" ).setValue( "1.2" );
oParser = new parserFormula( "LOGNORM.INV(A2, A3, A4)", "A1", ws );
ok( oParser.parse(), "LOGNORM.INV(A2, A3, A4)" );
strictEqual( oParser.calculate().getValue().toFixed(7) - 0, 4.0000252, "LOGNORM.INV(A2, A3, A4)" );
} );
test( "Test: \"GAMMA.DIST\"", function () { test( "Test: \"GAMMA.DIST\"", function () {
ws.getRange2( "A2" ).setValue( "10.00001131" ); ws.getRange2( "A2" ).setValue( "10.00001131" );
ws.getRange2( "A3" ).setValue( "9" ); ws.getRange2( "A3" ).setValue( "9" );
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
cBETA_INV, cBINOMDIST, cCHIDIST, cCHIINV, cCHISQ_DIST, cCHISQ_DIST_RT, cCHISQ_INV, cCHISQ_INV_RT, cCHITEST, cCONFIDENCE, cCORREL, cCOUNT, cCOUNTA, cCOUNTBLANK, cCOUNTIF, cBETA_INV, cBINOMDIST, cCHIDIST, cCHIINV, cCHISQ_DIST, cCHISQ_DIST_RT, cCHISQ_INV, cCHISQ_INV_RT, cCHITEST, cCONFIDENCE, cCORREL, cCOUNT, cCOUNTA, cCOUNTBLANK, cCOUNTIF,
cCOUNTIFS, cCOVAR, cCRITBINOM, cDEVSQ, cEXPONDIST, cFDIST, cF_DIST, cF_DIST_RT, cF_INV, cF_INV_RT, cFINV, cFISHER, cFISHERINV, cFORECAST, cFREQUENCY, cCOUNTIFS, cCOVAR, cCRITBINOM, cDEVSQ, cEXPONDIST, cFDIST, cF_DIST, cF_DIST_RT, cF_INV, cF_INV_RT, cFINV, cFISHER, cFISHERINV, cFORECAST, cFREQUENCY,
cFTEST, cGAMMA, cGAMMADIST, cGAMMAINV, cGAMMA_DIST, cGAMMA_INV, cGAMMALN, cGAMMALN_PRECISE, cGEOMEAN, cGROWTH, cHARMEAN, cHYPGEOMDIST, cINTERCEPT, cKURT, cLARGE, cFTEST, cGAMMA, cGAMMADIST, cGAMMAINV, cGAMMA_DIST, cGAMMA_INV, cGAMMALN, cGAMMALN_PRECISE, cGEOMEAN, cGROWTH, cHARMEAN, cHYPGEOMDIST, cINTERCEPT, cKURT, cLARGE,
cLINEST, cLOGEST, cLOGINV, cLOGNORM_DIST, cLOGNORMDIST, cMAX, cMAXA, cMEDIAN, cMIN, cMINA, cMODE, cNEGBINOMDIST, cNORMDIST, cLINEST, cLOGEST, cLOGINV, cLOGNORM_DIST, cLOGNORM_INV, cLOGNORMDIST, cMAX, cMAXA, cMEDIAN, cMIN, cMINA, cMODE, cNEGBINOMDIST, cNORMDIST,
cNORMINV, cNORMSDIST, cNORMSINV, cPEARSON, cPERCENTILE, cPERCENTRANK, cPERMUT, cPOISSON, cPROB, cQUARTILE, cNORMINV, cNORMSDIST, cNORMSINV, cPEARSON, cPERCENTILE, cPERCENTRANK, cPERMUT, cPOISSON, cPROB, cQUARTILE,
cRANK, cRSQ, cSKEW, cSLOPE, cSMALL, cSTANDARDIZE, cSTDEV, cSTDEVA, cSTDEVP, cSTDEVPA, cSTEYX, cTDIST, cT_DIST, cRANK, cRSQ, cSKEW, cSLOPE, cSMALL, cSTANDARDIZE, cSTDEV, cSTDEVA, cSTDEVP, cSTDEVPA, cSTEYX, cTDIST, cT_DIST,
cT_DIST_2T, cT_DIST_RT, cT_INV, cT_INV_2T, cTINV, cTREND, cTRIMMEAN, cTTEST, cVAR, cVARA, cVARP, cVARPA, cWEIBULL, cZTEST); cT_DIST_2T, cT_DIST_RT, cT_INV, cT_INV_2T, cTINV, cTREND, cTRIMMEAN, cTTEST, cVAR, cVARA, cVARP, cVARPA, cWEIBULL, cZTEST);
...@@ -4264,6 +4264,54 @@ ...@@ -4264,6 +4264,54 @@
return {name: this.name, args: "( x , mean , standard-deviation, cumulative )"} return {name: this.name, args: "( x , mean , standard-deviation, cumulative )"}
}; };
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cLOGNORM_INV() {
this.name = "LOGNORM.INV";
this.value = null;
this.argumentsCurrent = 0;
}
cLOGNORM_INV.prototype = Object.create(cBaseFunction.prototype);
cLOGNORM_INV.prototype.constructor = cLOGNORM_INV;
cLOGNORM_INV.prototype.argumentsMin = 3;
cLOGNORM_INV.prototype.argumentsMax = 3;
cLOGNORM_INV.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 normdist = function(argArray){
var fP = argArray[0];
var fMue = argArray[1];
var fSigma = argArray[2];
var res = null;
if ( fSigma <= 0.0 || fP <= 0.0 || fP >= 1.0 ){
return new cError(cErrorType.not_numeric);
}else{
res = Math.exp( fMue + fSigma * gaussinv( fP ));
}
return null !== res && !isNaN(res) ? new cNumber(res) : new cError(cErrorType.wrong_value_type);
};
return this.value = this._findArrayInNumberArguments(oArguments, normdist);
};
cLOGNORM_INV.prototype.getInfo = function () {
return {name: this.name, args: "( probability , mean, standard_dev )"}
};
/** /**
* @constructor * @constructor
* @extends {AscCommonExcel.cBaseFunction} * @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