Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
0ba8f5b8
Commit
0ba8f5b8
authored
Jun 14, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add GAMMAINV formula
parent
58e578ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
1 deletion
+73
-1
cell/.unit-tests/FormulaTests.js
cell/.unit-tests/FormulaTests.js
+10
-0
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+63
-1
No files found.
cell/.unit-tests/FormulaTests.js
View file @
0ba8f5b8
...
...
@@ -1099,6 +1099,16 @@ $( function () {
ok
(
oParser
.
parse
(),
"
GAMMA.INV(A2,A3,A4)
"
);
strictEqual
(
oParser
.
calculate
().
getValue
().
toFixed
(
7
)
-
0
,
10.0000112
,
"
GAMMA.INV(A2,A3,A4)
"
);
}
);
test
(
"
Test:
\"
GAMMAINV
\"
"
,
function
()
{
ws
.
getRange2
(
"
A2
"
).
setValue
(
"
0.068094
"
);
ws
.
getRange2
(
"
A3
"
).
setValue
(
"
9
"
);
ws
.
getRange2
(
"
A4
"
).
setValue
(
"
2
"
);
oParser
=
new
parserFormula
(
"
GAMMAINV(A2,A3,A4)
"
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
"
GAMMAINV(A2,A3,A4)
"
);
strictEqual
(
oParser
.
calculate
().
getValue
().
toFixed
(
7
)
-
0
,
10.0000112
,
"
GAMMAINV(A2,A3,A4)
"
);
}
);
test
(
"
Test:
\"
SUM(1,2,3)
\"
"
,
function
()
{
oParser
=
new
parserFormula
(
'
SUM(1,2,3)
'
,
"
A1
"
,
ws
);
...
...
cell/model/FormulaObjects/statisticalFunctions.js
View file @
0ba8f5b8
...
...
@@ -63,7 +63,7 @@
cFormulaFunctionGroup
[
'
Statistical
'
].
push
(
cAVEDEV
,
cAVERAGE
,
cAVERAGEA
,
cAVERAGEIF
,
cAVERAGEIFS
,
cBETADIST
,
cBETA_DIST
,
cBETA_INV
,
cBINOMDIST
,
cCHIDIST
,
cCHIINV
,
cCHITEST
,
cCONFIDENCE
,
cCORREL
,
cCOUNT
,
cCOUNTA
,
cCOUNTBLANK
,
cCOUNTIF
,
cCOUNTIFS
,
cCOVAR
,
cCRITBINOM
,
cDEVSQ
,
cEXPONDIST
,
cFDIST
,
cF_DIST
,
cF_DIST_RT
,
cFINV
,
cFISHER
,
cFISHERINV
,
cFORECAST
,
cFREQUENCY
,
cFTEST
,
cGAMMA
,
cGAMMA_DIST
,
cGAMMA_INV
,
cGAMMALN
,
cGAMMALN_PRECISE
,
cGEOMEAN
,
cGROWTH
,
cHARMEAN
,
cHYPGEOMDIST
,
cINTERCEPT
,
cKURT
,
cLARGE
,
cFTEST
,
cGAMMA
,
cGAMMA
INV
,
cGAMMA
_DIST
,
cGAMMA_INV
,
cGAMMALN
,
cGAMMALN_PRECISE
,
cGEOMEAN
,
cGROWTH
,
cHARMEAN
,
cHYPGEOMDIST
,
cINTERCEPT
,
cKURT
,
cLARGE
,
cLINEST
,
cLOGEST
,
cLOGINV
,
cLOGNORMDIST
,
cMAX
,
cMAXA
,
cMEDIAN
,
cMIN
,
cMINA
,
cMODE
,
cNEGBINOMDIST
,
cNORMDIST
,
cNORMINV
,
cNORMSDIST
,
cNORMSINV
,
cPEARSON
,
cPERCENTILE
,
cPERCENTRANK
,
cPERMUT
,
cPOISSON
,
cPROB
,
cQUARTILE
,
cRANK
,
cRSQ
,
cSKEW
,
cSLOPE
,
cSMALL
,
cSTANDARDIZE
,
cSTDEV
,
cSTDEVA
,
cSTDEVP
,
cSTDEVPA
,
cSTEYX
,
cTDIST
,
cT_DIST
,
...
...
@@ -2747,6 +2747,68 @@
return
{
name
:
this
.
name
,
args
:
"
(number)
"
}
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
//CLONE cGAMMA_INV FUNCTION
function
cGAMMAINV
()
{
this
.
name
=
"
GAMMAINV
"
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
}
cGAMMAINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cGAMMAINV
.
prototype
.
constructor
=
cGAMMAINV
;
cGAMMAINV
.
prototype
.
argumentsMin
=
3
;
cGAMMAINV
.
prototype
.
argumentsMax
=
3
;
cGAMMAINV
.
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
calcGamma
=
function
(
argArray
){
var
fP
=
argArray
[
0
];
var
fAlpha
=
argArray
[
1
];
var
fBeta
=
argArray
[
2
];
if
(
fAlpha
<=
0
||
fBeta
<=
0
||
fP
<
0
||
fP
>=
1
){
return
new
cError
(
cErrorType
.
not_numeric
);
}
var
res
=
null
;
if
(
fP
===
0
){
res
=
0
;
}
else
{
var
aFunc
=
new
GAMMADISTFUNCTION
(
fP
,
fAlpha
,
fBeta
);
var
fStart
=
fAlpha
*
fBeta
;
var
oVal
=
iterateInverse
(
aFunc
,
fStart
*
0.5
,
fStart
);
var
bConvError
=
oVal
.
bError
;
if
(
bConvError
){
return
new
cError
(
cErrorType
.
not_numeric
);
//SetError(FormulaError::NoConvergence);
}
res
=
oVal
.
val
;
}
return
null
!==
res
&&
!
isNaN
(
res
)
?
new
cNumber
(
res
)
:
new
cError
(
cErrorType
.
wrong_value_type
);
};
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
calcGamma
);
};
cGAMMAINV
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
(probability, alpha, beta )
"
}
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment