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
81f73586
Commit
81f73586
authored
Jul 14, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add PERMUTATIONA formula
parent
91a3aee0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
15 deletions
+54
-15
cell/.unit-tests/FormulaTests.js
cell/.unit-tests/FormulaTests.js
+9
-0
cell/model/FormulaObjects/_xlfnFunctions.js
cell/model/FormulaObjects/_xlfnFunctions.js
+2
-14
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+43
-1
No files found.
cell/.unit-tests/FormulaTests.js
View file @
81f73586
...
...
@@ -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
()
{
...
...
cell/model/FormulaObjects/_xlfnFunctions.js
View file @
81f73586
...
...
@@ -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
,
cP
ERMUTATIONA
,
cP
HI
);
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
,
cP
ERMUTATIONA
,
cP
HI
,
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}
...
...
cell/model/FormulaObjects/statisticalFunctions.js
View file @
81f73586
...
...
@@ -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
,
cP
ERMUTATIONA
,
cP
OISSON
,
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}
...
...
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