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
7212b014
Commit
7212b014
authored
Jun 16, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extend clone functions
parent
f47976fa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
275 deletions
+49
-275
cell/model/FormulaObjects/_xlfnFunctions.js
cell/model/FormulaObjects/_xlfnFunctions.js
+1
-13
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+48
-262
No files found.
cell/model/FormulaObjects/_xlfnFunctions.js
View file @
7212b014
...
...
@@ -60,7 +60,7 @@
cCHISQ_DIST
,
cCHISQ_DIST_RT
,
cCHISQ_INV
,
cCHISQ_INV_RT
,
cCHISQ_TEST
,
cCONFIDENCE_NORM
,
cCONFIDENCE_T
,
cCOVARIANCE_P
,
cCOVARIANCE_S
,
cF_DIST
,
cF_DIST_RT
,
cF_INV
,
cF_INV_RT
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cFORECAST_LINEAR
,
cGAMMA
,
cGAMMA_DIST
,
cGAMMA
_INV
,
cGAMMA
LN_PRECISE
,
cHYPGEOM_DIST
,
cLOGNORM_DIST
,
cLOGNORM_INV
,
cMODE_MULT
,
cMODE_SNGL
,
cGAMMALN_PRECISE
,
cHYPGEOM_DIST
,
cLOGNORM_DIST
,
cLOGNORM_INV
,
cMODE_MULT
,
cMODE_SNGL
,
cNEGBINOM_DIST
,
cNORM_DIST
,
cNORM_INV
,
cNORM_S_DIST
,
cNORM_S_INV
,
cPERCENTILE_EXC
,
cPERCENTILE_INC
,
cPERCENTRANK_EXC
,
cPERCENTRANK_INC
,
cPERMUTATIONA
,
cPHI
,
cPOISSON_DIST
,
cQUARTILE_EXC
,
cQUARTILE_INC
,
cRANK_AVG
,
cRANK_EQ
,
cSKEW_P
,
cSTDEV_P
,
cSTDEV_S
,
cT_DIST
,
cT_DIST_2T
,
cT_DIST_RT
,
cT_INV
,
cT_INV_2T
,
cT_TEST
,
cVAR_P
,
...
...
@@ -542,18 +542,6 @@
cGAMMA_DIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cGAMMA_DIST
.
prototype
.
constructor
=
cGAMMA_DIST
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cGAMMA_INV
()
{
cBaseFunction
.
call
(
this
,
"
GAMMA.INV
"
);
this
.
isXLFN
=
true
;
}
cGAMMA_INV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cGAMMA_INV
.
prototype
.
constructor
=
cGAMMA_INV
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
cell/model/FormulaObjects/statisticalFunctions.js
View file @
7212b014
...
...
@@ -62,8 +62,8 @@
cFormulaFunctionGroup
[
'
Statistical
'
]
=
cFormulaFunctionGroup
[
'
Statistical
'
]
||
[];
cFormulaFunctionGroup
[
'
Statistical
'
].
push
(
cAVEDEV
,
cAVERAGE
,
cAVERAGEA
,
cAVERAGEIF
,
cAVERAGEIFS
,
cBETADIST
,
cBETA_DIST
,
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
,
cEXPON_DIST
,
cEXPONDIST
,
cFDIST
,
cF_DIST
,
cF_DIST_RT
,
cF_INV
,
cF
_INV_RT
,
cFINV
,
cFISHER
,
cFISHERINV
,
cFORECAST
,
cFREQUENCY
,
cFTEST
,
cGAMMA
,
cGAMMA
DIST
,
cGAMMAINV
,
cGAMMA_DIST
,
cGAMMA_
INV
,
cGAMMALN
,
cGAMMALN_PRECISE
,
cGAUSS
,
cGEOMEAN
,
cGROWTH
,
cHARMEAN
,
cHYPGEOMDIST
,
cINTERCEPT
,
cKURT
,
cLARGE
,
cCOUNTIFS
,
cCOVAR
,
cCRITBINOM
,
cDEVSQ
,
cEXPON_DIST
,
cEXPONDIST
,
cFDIST
,
cF_DIST
,
cF_DIST_RT
,
cF_INV
,
cF
INV
,
cF_INV_RT
,
cFISHER
,
cFISHERINV
,
cFORECAST
,
cFREQUENCY
,
cFTEST
,
cGAMMA
,
cGAMMA
_DIST
,
cGAMMADIST
,
cGAMMA_INV
,
cGAMMA
INV
,
cGAMMALN
,
cGAMMALN_PRECISE
,
cGAUSS
,
cGEOMEAN
,
cGROWTH
,
cHARMEAN
,
cHYPGEOMDIST
,
cINTERCEPT
,
cKURT
,
cLARGE
,
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
,
cRANK
,
cRSQ
,
cSKEW
,
cSLOPE
,
cSMALL
,
cSTANDARDIZE
,
cSTDEV
,
cSTDEVA
,
cSTDEVP
,
cSTDEVPA
,
cSTEYX
,
cTDIST
,
cT_DIST
,
...
...
@@ -1771,48 +1771,15 @@
/**
* @constructor
* @extends {
AscCommonExcel.cBaseFunction
}
* @extends {
cCHIDIST
}
*/
//clone cCHIDIST function
function
cCHISQ_DIST_RT
()
{
cBaseFunction
.
call
(
this
,
"
CHISQ.DIST.RT
"
);
cCHIDIST
.
call
(
this
);
this
.
name
=
"
CHISQ.DIST.RT
"
;
}
cCHISQ_DIST_RT
.
prototype
=
Object
.
create
(
c
BaseFunction
.
prototype
);
cCHISQ_DIST_RT
.
prototype
=
Object
.
create
(
c
CHIDIST
.
prototype
);
cCHISQ_DIST_RT
.
prototype
.
constructor
=
cCHISQ_DIST_RT
;
cCHISQ_DIST_RT
.
prototype
.
argumentsMin
=
2
;
cCHISQ_DIST_RT
.
prototype
.
argumentsMax
=
2
;
cCHISQ_DIST_RT
.
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
;
}
var
calcTDist
=
function
(
argArray
){
var
fChi
=
argArray
[
0
];
var
fDF
=
parseInt
(
argArray
[
1
]);
if
(
fDF
<
1
||
fChi
<
0
||
fDF
>
Math
.
pow
(
10
,
10
)){
return
new
cError
(
cErrorType
.
not_numeric
);
}
var
res
=
getChiDist
(
fChi
,
fDF
);
return
null
!==
res
&&
!
isNaN
(
res
)
?
new
cNumber
(
res
)
:
new
cError
(
cErrorType
.
wrong_value_type
);
};
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
calcTDist
);
};
cCHISQ_DIST_RT
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
(x, deg_freedom)
"
};
};
/**
* @constructor
...
...
@@ -2893,64 +2860,6 @@
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cF_INV_RT
()
{
cBaseFunction
.
call
(
this
,
"
F.INV.RT
"
);
}
//clone cFINV formula
cF_INV_RT
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cF_INV_RT
.
prototype
.
constructor
=
cF_INV_RT
;
cF_INV_RT
.
prototype
.
argumentsMin
=
3
;
cF_INV_RT
.
prototype
.
argumentsMax
=
3
;
cF_INV_RT
.
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
calcFDist
=
function
(
argArray
){
var
fP
=
argArray
[
0
];
var
fF1
=
parseInt
(
argArray
[
1
]);
var
fF2
=
parseInt
(
argArray
[
2
]);
if
(
fP
<=
0
||
fF1
<
1
||
fF2
<
1
||
fF1
>=
1.0E10
||
fF2
>=
1.0E10
||
fP
>
1
){
return
new
cError
(
cErrorType
.
not_numeric
);
}
var
aFunc
=
new
FDISTFUNCTION
(
fP
,
fF1
,
fF2
);
var
oVal
=
iterateInverse
(
aFunc
,
fF1
*
0.5
,
fF1
);
var
bConvError
=
oVal
.
bError
;
if
(
bConvError
){
return
new
cError
(
cErrorType
.
not_numeric
);
}
var
res
=
oVal
.
val
;
return
null
!==
res
&&
!
isNaN
(
res
)
?
new
cNumber
(
res
)
:
new
cError
(
cErrorType
.
wrong_value_type
);
};
if
(
argClone
[
1
].
getValue
()
<
1
){
return
this
.
value
=
new
cError
(
cErrorType
.
not_numeric
);
}
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
calcFDist
);
};
cF_INV_RT
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
(probability, deg_freedom1, deg_freedom2)
"
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
@@ -3009,6 +2918,18 @@
};
};
/**
* @constructor
* @extends {cFINV}
*/
function
cF_INV_RT
()
{
cFINV
.
call
(
this
);
this
.
name
=
"
F.INV.RT
"
;
}
cF_INV_RT
.
prototype
=
Object
.
create
(
cFINV
.
prototype
);
cF_INV_RT
.
prototype
.
constructor
=
cF_INV_RT
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
@@ -3345,125 +3266,6 @@
return
{
name
:
this
.
name
,
args
:
"
(number)
"
}
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
//CLONE cGAMMA_DIST FUNCTION
function
cGAMMADIST
()
{
this
.
name
=
"
GAMMADIST
"
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
}
cGAMMADIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cGAMMADIST
.
prototype
.
constructor
=
cGAMMADIST
;
cGAMMADIST
.
prototype
.
argumentsMin
=
4
;
cGAMMADIST
.
prototype
.
argumentsMax
=
4
;
cGAMMADIST
.
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
();
argClone
[
3
]
=
argClone
[
3
].
tocNumber
();
var
argError
;
if
(
argError
=
this
.
_checkErrorArg
(
argClone
))
{
return
this
.
value
=
argError
;
}
var
calcGamma
=
function
(
argArray
){
var
fX
=
argArray
[
0
];
var
fAlpha
=
argArray
[
1
];
var
fBeta
=
argArray
[
2
];
var
bCumulative
=
argArray
[
3
];
var
res
=
null
;
if
((
fX
<
0
)
||
fAlpha
<=
0
||
fBeta
<=
0
){
return
new
cError
(
cErrorType
.
not_numeric
);
}
else
{
if
(
bCumulative
)
{
res
=
getGammaDist
(
fX
,
fAlpha
,
fBeta
);
}
else
{
res
=
getGammaDistPDF
(
fX
,
fAlpha
,
fBeta
);
}
}
return
null
!==
res
&&
!
isNaN
(
res
)
?
new
cNumber
(
res
)
:
new
cError
(
cErrorType
.
wrong_value_type
);
};
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
calcGamma
);
};
cGAMMADIST
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
(x, alpha, beta, cumulative )
"
}
};
/**
* @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}
...
...
@@ -3520,6 +3322,18 @@
return
{
name
:
this
.
name
,
args
:
"
(x, alpha, beta, cumulative )
"
}
};
/**
* @constructor
* @extends {cGAMMA_DIST}
*/
function
cGAMMADIST
()
{
cGAMMA_DIST
.
call
(
this
);
this
.
name
=
"
GAMMADIST
"
;
}
cGAMMADIST
.
prototype
=
Object
.
create
(
cGAMMA_DIST
.
prototype
);
cGAMMADIST
.
prototype
.
constructor
=
cGAMMADIST
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
@@ -3534,6 +3348,7 @@
cGAMMA_INV
.
prototype
.
constructor
=
cGAMMA_INV
;
cGAMMA_INV
.
prototype
.
argumentsMin
=
3
;
cGAMMA_INV
.
prototype
.
argumentsMax
=
3
;
cGAMMA_INV
.
prototype
.
isXLFN
=
true
;
cGAMMA_INV
.
prototype
.
Calculate
=
function
(
arg
)
{
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
],
true
);
var
argClone
=
oArguments
.
args
;
...
...
@@ -3581,6 +3396,18 @@
return
{
name
:
this
.
name
,
args
:
"
(probability, alpha, beta )
"
}
};
/**
* @constructor
* @extends {cGAMMA_INV}
*/
function
cGAMMAINV
()
{
cGAMMA_INV
.
call
(
this
);
this
.
name
=
"
GAMMAINV
"
;
}
cGAMMAINV
.
prototype
=
Object
.
create
(
cGAMMA_INV
.
prototype
);
cGAMMAINV
.
prototype
.
constructor
=
cGAMMAINV
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
@@ -7083,56 +6910,15 @@
/**
* @constructor
* @extends {
AscCommonExcel.cBaseFunction
}
* @extends {
cT_INV_2T
}
*/
function
cTINV
()
{
cBaseFunction
.
call
(
this
,
"
TINV
"
);
cT_INV_2T
.
call
(
this
);
this
.
name
=
"
TINV
"
;
}
//clone T.INV.2T
cTINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cTINV
.
prototype
.
constructor
=
cTINV
;
cTINV
.
prototype
.
argumentsMin
=
2
;
cTINV
.
prototype
.
argumentsMax
=
2
;
cTINV
.
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
;
}
var
calcTDist
=
function
(
argArray
){
var
fP
=
argArray
[
0
];
var
fDF
=
parseInt
(
argArray
[
1
]);
//ms игнорирует услвие fP > 1. сделал как в документации
if
(
fDF
<
1.0
||
fP
<=
0
||
fP
>
1
){
return
new
cError
(
cErrorType
.
not_numeric
);
}
var
aFunc
=
new
TDISTFUNCTION
(
fP
,
fDF
,
2
);
var
oVal
=
iterateInverse
(
aFunc
,
fDF
*
0.5
,
fDF
);
var
bConvError
=
oVal
.
bError
;
var
res
=
oVal
.
val
;
if
(
bConvError
){
return
new
cError
(
cErrorType
.
not_numeric
);
}
return
null
!==
res
&&
!
isNaN
(
res
)
?
new
cNumber
(
res
)
:
new
cError
(
cErrorType
.
wrong_value_type
);
};
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
calcTDist
);
};
cTINV
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
(probability, deg_freedom)
"
};
};
cTINV
.
prototype
=
Object
.
create
(
cT_INV_2T
.
prototype
);
cTINV
.
prototype
.
constructor
=
cTINV
;
/**
* @constructor
...
...
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