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
56bfe1a8
Commit
56bfe1a8
authored
Jun 15, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add T.INV.2T formula
parent
38f6881b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
1 deletion
+63
-1
cell/.unit-tests/FormulaTests.js
cell/.unit-tests/FormulaTests.js
+9
-0
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+54
-1
No files found.
cell/.unit-tests/FormulaTests.js
View file @
56bfe1a8
...
@@ -1045,6 +1045,15 @@ $( function () {
...
@@ -1045,6 +1045,15 @@ $( function () {
strictEqual
(
oParser
.
calculate
().
getValue
().
toFixed
(
7
)
-
0
,
0.8164966
,
"
T.INV(0.75,2)
"
);
strictEqual
(
oParser
.
calculate
().
getValue
().
toFixed
(
7
)
-
0
,
0.8164966
,
"
T.INV(0.75,2)
"
);
}
);
}
);
test
(
"
Test:
\"
T.INV.2T
\"
"
,
function
()
{
ws
.
getRange2
(
"
A2
"
).
setValue
(
"
0.546449
"
);
ws
.
getRange2
(
"
A3
"
).
setValue
(
"
60
"
);
oParser
=
new
parserFormula
(
"
T.INV.2T(A2,A3)
"
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
"
T.INV.2T(A2,A3)
"
);
strictEqual
(
oParser
.
calculate
().
getValue
().
toFixed
(
6
)
-
0
,
0.606533
,
"
T.INV.2T(A2,A3)
"
);
}
);
test
(
"
Test:
\"
GAMMA
\"
"
,
function
()
{
test
(
"
Test:
\"
GAMMA
\"
"
,
function
()
{
oParser
=
new
parserFormula
(
"
GAMMA(2.5)
"
,
"
A1
"
,
ws
);
oParser
=
new
parserFormula
(
"
GAMMA(2.5)
"
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
"
GAMMA(2.5)
"
);
ok
(
oParser
.
parse
(),
"
GAMMA(2.5)
"
);
...
...
cell/model/FormulaObjects/statisticalFunctions.js
View file @
56bfe1a8
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
cLINEST
,
cLOGEST
,
cLOGINV
,
cLOGNORMDIST
,
cMAX
,
cMAXA
,
cMEDIAN
,
cMIN
,
cMINA
,
cMODE
,
cNEGBINOMDIST
,
cNORMDIST
,
cLINEST
,
cLOGEST
,
cLOGINV
,
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
,
cTINV
,
cTREND
,
cTRIMMEAN
,
cTTEST
,
cVAR
,
cVARA
,
cVARP
,
cVARPA
,
cWEIBULL
,
cZTEST
);
cT_DIST_2T
,
cT_DIST_RT
,
cT_INV
,
cT
_INV_2T
,
cT
INV
,
cTREND
,
cTRIMMEAN
,
cTTEST
,
cVAR
,
cVARA
,
cVARP
,
cVARPA
,
cWEIBULL
,
cZTEST
);
function
isInteger
(
value
)
{
function
isInteger
(
value
)
{
return
typeof
value
===
'
number
'
&&
isFinite
(
value
)
&&
Math
.
floor
(
value
)
===
value
;
return
typeof
value
===
'
number
'
&&
isFinite
(
value
)
&&
Math
.
floor
(
value
)
===
value
;
...
@@ -6826,6 +6826,59 @@
...
@@ -6826,6 +6826,59 @@
};
};
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cT_INV_2T
()
{
cBaseFunction
.
call
(
this
,
"
T.INV.2T
"
);
}
cT_INV_2T
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cT_INV_2T
.
prototype
.
constructor
=
cT_INV_2T
;
cT_INV_2T
.
prototype
.
argumentsMin
=
2
;
cT_INV_2T
.
prototype
.
argumentsMax
=
2
;
cT_INV_2T
.
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
);
};
cT_INV_2T
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
(probability, deg_freedom)
"
};
};
/**
/**
* @constructor
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
* @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