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
d7656ac7
Commit
d7656ac7
authored
Jun 22, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify BINOMDIST
add BINOM.DIST formula
parent
b196a19d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
66 deletions
+46
-66
cell/model/FormulaObjects/_xlfnFunctions.js
cell/model/FormulaObjects/_xlfnFunctions.js
+2
-14
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+44
-52
No files found.
cell/model/FormulaObjects/_xlfnFunctions.js
View file @
d7656ac7
...
...
@@ -56,7 +56,7 @@
cFormulaFunctionGroup
[
'
TextAndData
'
]
=
cFormulaFunctionGroup
[
'
TextAndData
'
]
||
[];
cFormulaFunctionGroup
[
'
TextAndData
'
].
push
(
cDBCS
,
cUNICHAR
,
cUNICODE
);
cFormulaFunctionGroup
[
'
Statistical
'
]
=
cFormulaFunctionGroup
[
'
Statistical
'
]
||
[];
cFormulaFunctionGroup
[
'
Statistical
'
].
push
(
cBINOM_DIST
,
cBINOM_DIST
_RANGE
,
cBINOM_INV
,
cCHISQ_TEST
,
cCOVARIANCE_P
,
cFormulaFunctionGroup
[
'
Statistical
'
].
push
(
cBINOM_DIST_RANGE
,
cBINOM_INV
,
cCHISQ_TEST
,
cCOVARIANCE_P
,
cCOVARIANCE_S
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cFORECAST_LINEAR
,
cHYPGEOM_DIST
,
cMODE_MULT
,
cMODE_SNGL
,
cNEGBINOM_DIST
,
cNORM_DIST
,
cNORM_INV
,
cNORM_S_DIST
,
cNORM_S_INV
,
cPERMUTATIONA
,
cPHI
,
cPOISSON_DIST
,
cQUARTILE_EXC
,
cQUARTILE_INC
,
cSKEW_P
,
cSTDEV_P
,
cSTDEV_S
,
...
...
@@ -72,7 +72,7 @@
cFormulaFunctionGroup
[
'
NotRealised
'
]
=
cFormulaFunctionGroup
[
'
NotRealised
'
]
||
[];
cFormulaFunctionGroup
[
'
NotRealised
'
].
push
(
cDAYS
,
cISOWEEKNUM
,
cBITAND
,
cBITLSHIFT
,
cBITOR
,
cBITRSHIFT
,
cBITXOR
,
cERF_PRECISE
,
cERFC_PRECISE
,
cDBCS
,
cUNICHAR
,
cUNICODE
,
cBINOM_DIST
,
cBINOM_DIST
_RANGE
,
cBINOM_INV
,
cCHISQ_TEST
,
cERF_PRECISE
,
cERFC_PRECISE
,
cDBCS
,
cUNICHAR
,
cUNICODE
,
cBINOM_DIST_RANGE
,
cBINOM_INV
,
cCHISQ_TEST
,
cCOVARIANCE_P
,
cCOVARIANCE_S
,
cF_TEST
,
cFORECAST_ETS
,
cFORECAST_ETS_CONFINT
,
cFORECAST_ETS_SEASONALITY
,
cFORECAST_ETS_STAT
,
cFORECAST_LINEAR
,
cHYPGEOM_DIST
,
cMODE_MULT
,
cMODE_SNGL
,
cNEGBINOM_DIST
,
cNORM_DIST
,
cNORM_INV
,
cNORM_S_DIST
,
cNORM_S_INV
,
cPERMUTATIONA
,
cPHI
,
cPOISSON_DIST
,
cQUARTILE_EXC
,
cQUARTILE_INC
,
cSKEW_P
,
...
...
@@ -91,18 +91,6 @@
cAGGREGATE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cAGGREGATE
.
prototype
.
constructor
=
cAGGREGATE
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cBINOM_DIST
()
{
cBaseFunction
.
call
(
this
,
"
BINOM.DIST
"
);
this
.
isXLFN
=
true
;
}
cBINOM_DIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cBINOM_DIST
.
prototype
.
constructor
=
cBINOM_DIST
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
cell/model/FormulaObjects/statisticalFunctions.js
View file @
d7656ac7
...
...
@@ -61,7 +61,7 @@
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
,
cBETA_DIST
,
cBETA_INV
,
cBINOMDIST
,
c
BINOM_DIST
,
c
CHIDIST
,
cCHIINV
,
cCHISQ_DIST
,
cCHISQ_DIST_RT
,
cCHISQ_INV
,
cCHISQ_INV_RT
,
cCHITEST
,
cCONFIDENCE
,
cCONFIDENCE_NORM
,
cCONFIDENCE_T
,
cCORREL
,
cCOUNT
,
cCOUNTA
,
cCOUNTBLANK
,
cCOUNTIF
,
cCOUNTIFS
,
cCOVAR
,
cCRITBINOM
,
cDEVSQ
,
cEXPON_DIST
,
cEXPONDIST
,
cF_DIST
,
cFDIST
,
cF_DIST_RT
,
cF_INV
,
cFINV
,
cF_INV_RT
,
cFISHER
,
cFISHERINV
,
cFORECAST
,
cFREQUENCY
,
cFTEST
,
cGAMMA
,
cGAMMA_DIST
,
cGAMMADIST
,
cGAMMA_INV
,
cGAMMAINV
,
cGAMMALN
,
cGAMMALN_PRECISE
,
cGAUSS
,
...
...
@@ -1655,7 +1655,18 @@
cBINOMDIST
.
prototype
.
argumentsMin
=
4
;
cBINOMDIST
.
prototype
.
argumentsMax
=
4
;
cBINOMDIST
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
arg2
=
arg
[
2
],
arg3
=
arg
[
3
];
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
();
//bool
var
argError
;
if
(
argError
=
this
.
_checkErrorArg
(
argClone
))
{
return
this
.
value
=
argError
;
}
function
binomdist
(
x
,
n
,
p
)
{
x
=
parseInt
(
x
);
...
...
@@ -1663,63 +1674,44 @@
return
Math
.
binomCoeff
(
n
,
x
)
*
Math
.
pow
(
p
,
x
)
*
Math
.
pow
(
1
-
p
,
n
-
x
);
}
if
(
arg0
instanceof
cArea
||
arg0
instanceof
cArea3D
)
{
arg0
=
arg0
.
cross
(
arguments
[
1
])
;
}
else
if
(
arg0
instanceof
cArray
)
{
arg0
=
arg0
.
getElement
(
0
)
;
}
var
calcBinom
=
function
(
argArray
)
{
var
arg0
=
argArray
[
0
]
;
var
arg1
=
argArray
[
1
];
var
arg2
=
argArray
[
2
]
;
var
arg3
=
argArray
[
3
];
if
(
arg1
instanceof
cArea
||
arg1
instanceof
cArea3D
)
{
arg1
=
arg1
.
cross
(
arguments
[
1
]);
}
else
if
(
arg1
instanceof
cArray
)
{
arg1
=
arg1
.
getElement
(
0
);
}
if
(
arg0
<
0
||
arg0
>
arg1
||
arg2
<
0
||
arg2
>
1
)
{
return
new
cError
(
cErrorType
.
not_numeric
);
}
if
(
arg2
instanceof
cArea
||
arg2
instanceof
cArea3D
)
{
arg2
=
arg2
.
cross
(
arguments
[
1
]);
}
else
if
(
arg2
instanceof
cArray
)
{
arg2
=
arg2
.
getElement
(
0
);
}
if
(
arg3
)
{
var
x
=
parseInt
(
arg0
),
n
=
parseInt
(
arg1
),
p
=
arg2
,
bm
=
0
;
if
(
arg3
instanceof
cArea
||
arg3
instanceof
cArea3D
)
{
arg3
=
arg3
.
cross
(
arguments
[
1
]);
}
else
if
(
arg3
instanceof
cArray
)
{
arg3
=
arg3
.
getElement
(
0
);
}
arg0
=
arg0
.
tocNumber
();
arg1
=
arg1
.
tocNumber
();
arg2
=
arg2
.
tocNumber
();
arg3
=
arg3
.
tocBool
();
for
(
var
y
=
0
;
y
<=
x
;
y
++
)
{
bm
+=
binomdist
(
y
,
n
,
p
);
}
if
(
arg0
instanceof
cError
)
{
return
this
.
value
=
arg0
;
}
if
(
arg1
instanceof
cError
)
{
return
this
.
value
=
arg1
;
}
if
(
arg2
instanceof
cError
)
{
return
this
.
value
=
arg2
;
}
if
(
arg3
instanceof
cError
)
{
return
this
.
value
=
arg3
;
}
return
new
cNumber
(
bm
);
}
else
{
return
new
cNumber
(
binomdist
(
arg0
,
arg1
,
arg2
));
}
};
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
calcBinom
);
};
if
(
arg0
.
getValue
()
<
0
||
arg0
.
getValue
()
>
arg1
.
getValue
()
||
arg2
.
getValue
()
<
0
||
arg2
.
getValue
()
>
1
)
{
return
this
.
value
=
new
cError
(
cErrorType
.
not_numeric
);
}
/**
* @constructor
* @extends {cBINOMDIST}
*/
function
cBINOM_DIST
()
{
cBINOMDIST
.
call
(
this
);
this
.
name
=
"
BINOM.DIST
"
;
}
if
(
arg3
.
toBool
())
{
var
x
=
parseInt
(
arg0
.
getValue
()),
n
=
parseInt
(
arg1
.
getValue
()),
p
=
arg2
.
getValue
(),
bm
=
0
;
for
(
var
y
=
0
;
y
<=
x
;
y
++
)
{
bm
+=
binomdist
(
y
,
n
,
p
);
}
return
this
.
value
=
new
cNumber
(
bm
);
}
else
{
return
this
.
value
=
new
cNumber
(
binomdist
(
arg0
.
getValue
(),
arg1
.
getValue
(),
arg2
.
getValue
()));
}
};
cBINOM_DIST
.
prototype
=
Object
.
create
(
cBINOMDIST
.
prototype
);
cBINOM_DIST
.
prototype
.
constructor
=
cBINOM_DIST
;
cBINOM_DIST
.
prototype
.
isXLFN
=
true
;
/**
* @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