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
4e9597f2
Commit
4e9597f2
authored
Jun 15, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add LOGNORM.DIST formula
parent
ab3241de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
18 deletions
+76
-18
cell/.unit-tests/FormulaTests.js
cell/.unit-tests/FormulaTests.js
+12
-17
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+64
-1
No files found.
cell/.unit-tests/FormulaTests.js
View file @
4e9597f2
...
...
@@ -1054,23 +1054,18 @@ $( function () {
strictEqual
(
oParser
.
calculate
().
getValue
().
toFixed
(
6
)
-
0
,
0.606533
,
"
T.INV.2T(A2,A3)
"
);
}
);
test
(
"
Test:
\"
GAMMA
\"
"
,
function
()
{
oParser
=
new
parserFormula
(
"
GAMMA(2.5)
"
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
"
GAMMA(2.5)
"
);
strictEqual
(
oParser
.
calculate
().
getValue
().
toFixed
(
3
)
-
0
,
1.329
,
"
GAMMA(2.5)
"
);
oParser
=
new
parserFormula
(
"
GAMMA(-3.75)
"
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
"
GAMMA(-3.75)
"
);
strictEqual
(
oParser
.
calculate
().
getValue
().
toFixed
(
3
)
-
0
,
0.268
,
"
GAMMA(0.268)
"
);
oParser
=
new
parserFormula
(
"
GAMMA(0)
"
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
"
GAMMA(0)
"
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
"
#NUM!
"
,
"
GAMMA(0)
"
);
oParser
=
new
parserFormula
(
"
GAMMA(-2)
"
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
"
GAMMA(-2)
"
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
"
#NUM!
"
,
"
GAMMA(-2)
"
);
test
(
"
Test:
\"
LOGNORM.DIST
\"
"
,
function
()
{
ws
.
getRange2
(
"
A2
"
).
setValue
(
"
4
"
);
ws
.
getRange2
(
"
A3
"
).
setValue
(
"
3.5
"
);
ws
.
getRange2
(
"
A4
"
).
setValue
(
"
1.2
"
);
oParser
=
new
parserFormula
(
"
LOGNORM.DIST(A2,A3,A4,TRUE)
"
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
"
LOGNORM.DIST(A2,A3,A4,TRUE)
"
);
strictEqual
(
oParser
.
calculate
().
getValue
().
toFixed
(
7
)
-
0
,
0.0390836
,
"
LOGNORM.DIST(A2,A3,A4,TRUE)
"
);
oParser
=
new
parserFormula
(
"
LOGNORM.DIST(A2,A3,A4,FALSE)
"
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
"
LOGNORM.DIST(A2,A3,A4,FALSE)
"
);
strictEqual
(
oParser
.
calculate
().
getValue
().
toFixed
(
7
)
-
0
,
0.0176176
,
"
LOGNORM.DIST(A2,A3,A4,FALSE)
"
);
}
);
test
(
"
Test:
\"
GAMMA.DIST
\"
"
,
function
()
{
...
...
cell/model/FormulaObjects/statisticalFunctions.js
View file @
4e9597f2
...
...
@@ -64,7 +64,7 @@
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
,
cEXPONDIST
,
cFDIST
,
cF_DIST
,
cF_DIST_RT
,
cF_INV
,
cF_INV_RT
,
cFINV
,
cFISHER
,
cFISHERINV
,
cFORECAST
,
cFREQUENCY
,
cFTEST
,
cGAMMA
,
cGAMMADIST
,
cGAMMAINV
,
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
,
cLINEST
,
cLOGEST
,
cLOGINV
,
cLOGNORM
_DIST
,
cLOGNORM
DIST
,
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
,
cT_DIST_2T
,
cT_DIST_RT
,
cT_INV
,
cT_INV_2T
,
cTINV
,
cTREND
,
cTRIMMEAN
,
cTTEST
,
cVAR
,
cVARA
,
cVARP
,
cVARPA
,
cWEIBULL
,
cZTEST
);
...
...
@@ -4201,6 +4201,69 @@
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cLOGNORM_DIST
()
{
this
.
name
=
"
LOGNORM.DIST
"
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
}
cLOGNORM_DIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cLOGNORM_DIST
.
prototype
.
constructor
=
cLOGNORM_DIST
;
cLOGNORM_DIST
.
prototype
.
argumentsMin
=
4
;
cLOGNORM_DIST
.
prototype
.
argumentsMax
=
4
;
cLOGNORM_DIST
.
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
normdist
=
function
(
argArray
){
var
x
=
argArray
[
0
];
var
mue
=
argArray
[
1
];
var
sigma
=
argArray
[
2
];
var
bCumulative
=
argArray
[
3
];
var
res
=
null
;
if
(
sigma
<=
0.0
)
{
return
new
cError
(
cErrorType
.
not_numeric
);
}
if
(
bCumulative
)
{
if
(
x
<=
0
){
res
=
0
;
}
else
{
res
=
0.5
+
gauss
((
Math
.
ln
(
x
)
-
mue
)
/
sigma
);
}
}
else
{
if
(
x
<=
0
){
return
new
cError
(
cErrorType
.
not_numeric
);
}
else
{
res
=
phi
((
Math
.
log
(
x
)
-
mue
)
/
sigma
)
/
sigma
/
x
;
}
}
return
null
!==
res
&&
!
isNaN
(
res
)
?
new
cNumber
(
res
)
:
new
cError
(
cErrorType
.
wrong_value_type
);
};
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
normdist
);
};
cLOGNORM_DIST
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( x , mean , standard-deviation, cumulative )
"
}
};
/**
* @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