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
3ba0579b
Commit
3ba0579b
authored
Jun 10, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
instanceof -> check type
parent
dba3078c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
197 additions
and
208 deletions
+197
-208
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+197
-208
No files found.
cell/model/FormulaObjects/statisticalFunctions.js
View file @
3ba0579b
...
...
@@ -582,128 +582,117 @@ cAVERAGEA.prototype.getInfo = function () {
};
};
function
cAVERAGEIF
()
{
// cBaseFunction.call( this, "AVERAGEIF", 2, 3 );
this
.
name
=
"
AVERAGEIF
"
;
this
.
type
=
cElementType
.
func
;
this
.
value
=
null
;
this
.
argumentsMin
=
2
;
this
.
argumentsCurrent
=
0
;
this
.
argumentsMax
=
3
;
this
.
formatType
=
{
def
:
-
1
,
//подразумевается формат первой ячейки входящей в формулу.
noneFormat
:
-
2
};
this
.
numFormat
=
this
.
formatType
.
def
;
}
cAVERAGEIF
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cAVERAGEIF
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
arg2
=
arg
[
2
]
?
arg
[
2
]
:
arg
[
0
],
_sum
=
0
,
_count
=
0
,
valueForSearching
;
if
(
!
(
arg0
instanceof
cRef
||
arg0
instanceof
cRef3D
||
arg0
instanceof
cArea
)
)
{
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
if
(
!
(
arg2
instanceof
cRef
||
arg2
instanceof
cRef3D
||
arg2
instanceof
cArea
)
)
{
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
if
(
arg1
instanceof
cArea
||
arg1
instanceof
cArea3D
)
{
arg1
=
arg1
.
cross
(
arguments
[
1
].
first
);
}
else
if
(
arg1
instanceof
cArray
)
{
arg1
=
arg1
.
getElementRowCol
(
0
,
0
);
}
arg1
=
arg1
.
tocString
();
if
(
!
(
arg1
instanceof
cString
)
)
{
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
arg1
=
arg1
.
toString
();
var
operators
=
new
RegExp
(
"
^ *[<=> ]+ *
"
),
match
=
arg1
.
match
(
operators
),
search
,
oper
,
val
;
if
(
match
)
{
search
=
arg1
.
substr
(
match
[
0
].
length
);
oper
=
match
[
0
].
replace
(
/
\s
/g
,
""
);
}
else
{
search
=
arg1
;
}
valueForSearching
=
parseNum
(
search
)
?
new
cNumber
(
search
)
:
new
cString
(
search
);
if
(
arg0
instanceof
cArea
)
{
var
r
=
arg0
.
getRange
().
first
.
getRow0
(),
ws
=
arg0
.
getWS
(),
c
/*c1*/
=
arg2
.
getRange
().
first
.
getCol0
(),
i
=
0
,
tmpCellArg0
=
arg0
.
getRange
().
getCells
()[
0
],
tmpCellArg2
=
arg2
.
getRange
(),
offset
,
bbox
,
r2
;
arg0
.
foreach2
(
function
(
v
,
cell
)
{
if
(
matching
(
v
,
valueForSearching
,
oper
)
)
{
offset
=
cell
.
getOffset
(
tmpCellArg0
);
tmpCellArg2
=
arg2
.
getRange
();
tmpCellArg2
.
setOffset
(
offset
);
bbox
=
tmpCellArg2
.
getBBox0
();
offset
.
offsetCol
*=
-
1
;
offset
.
offsetRow
*=
-
1
;
r2
=
new
cRef
(
ws
.
getRange3
(
bbox
.
r1
,
bbox
.
c1
,
bbox
.
r1
,
bbox
.
c1
).
getName
(),
ws
);
tmpCellArg2
.
setOffset
(
offset
);
if
(
r2
.
getValue
()
instanceof
cNumber
)
{
_sum
+=
r2
.
getValue
().
getValue
();
function
cAVERAGEIF
()
{
this
.
name
=
"
AVERAGEIF
"
;
this
.
type
=
cElementType
.
func
;
this
.
value
=
null
;
this
.
argumentsMin
=
2
;
this
.
argumentsCurrent
=
0
;
this
.
argumentsMax
=
3
;
this
.
formatType
=
{
def
:
-
1
,
//подразумевается формат первой ячейки входящей в формулу.
noneFormat
:
-
2
};
this
.
numFormat
=
this
.
formatType
.
def
;
}
cAVERAGEIF
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cAVERAGEIF
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
arg2
=
arg
[
2
]
?
arg
[
2
]
:
arg
[
0
],
_sum
=
0
,
_count
=
0
,
valueForSearching
;
if
((
cElementType
.
cell
!==
arg0
.
type
&&
cElementType
.
cell3D
!==
arg0
.
type
&&
cElementType
.
cellsRange
!==
arg0
.
type
)
||
(
cElementType
.
cell
!==
arg2
.
type
&&
cElementType
.
cell3D
!==
arg2
.
type
&&
cElementType
.
cellsRange
!==
arg2
.
type
))
{
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
if
(
cElementType
.
cellsRange
===
arg1
.
type
||
cElementType
.
cellsRange3D
===
arg1
.
type
)
{
arg1
=
arg1
.
cross
(
arguments
[
1
].
first
);
}
else
if
(
arg1
instanceof
cArray
)
{
arg1
=
arg1
.
getElementRowCol
(
0
,
0
);
}
arg1
=
arg1
.
tocString
();
if
(
cElementType
.
string
!==
arg1
.
type
)
{
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
arg1
=
arg1
.
toString
();
var
operators
=
new
RegExp
(
"
^ *[<=> ]+ *
"
),
match
=
arg1
.
match
(
operators
),
search
,
oper
,
val
;
if
(
match
)
{
search
=
arg1
.
substr
(
match
[
0
].
length
);
oper
=
match
[
0
].
replace
(
/
\s
/g
,
""
);
}
else
{
search
=
arg1
;
}
valueForSearching
=
parseNum
(
search
)
?
new
cNumber
(
search
)
:
new
cString
(
search
);
if
(
arg0
instanceof
cArea
)
{
var
r
=
arg0
.
getRange
().
first
.
getRow0
(),
ws
=
arg0
.
getWS
(),
c
/*c1*/
=
arg2
.
getRange
().
first
.
getCol0
(),
i
=
0
,
tmpCellArg0
=
arg0
.
getRange
()
.
getCells
()[
0
],
tmpCellArg2
=
arg2
.
getRange
(),
offset
,
bbox
,
r2
;
arg0
.
foreach2
(
function
(
v
,
cell
)
{
if
(
matching
(
v
,
valueForSearching
,
oper
))
{
offset
=
cell
.
getOffset
(
tmpCellArg0
);
tmpCellArg2
=
arg2
.
getRange
();
tmpCellArg2
.
setOffset
(
offset
);
bbox
=
tmpCellArg2
.
getBBox0
();
offset
.
offsetCol
*=
-
1
;
offset
.
offsetRow
*=
-
1
;
r2
=
new
cRef
(
ws
.
getRange3
(
bbox
.
r1
,
bbox
.
c1
,
bbox
.
r1
,
bbox
.
c1
).
getName
(),
ws
);
tmpCellArg2
.
setOffset
(
offset
);
if
(
cElementType
.
number
===
r2
.
getValue
().
type
)
{
_sum
+=
r2
.
getValue
().
getValue
();
_count
++
;
}
}
i
++
;
})
}
else
{
val
=
arg0
.
getValue
();
if
(
matching
(
val
,
valueForSearching
,
oper
))
{
var
r
=
arg0
.
getRange
(),
ws
=
arg0
.
getWS
(),
r1
=
r
.
first
.
getRow0
()
+
0
,
c1
=
arg2
.
getRange
().
first
.
getCol0
();
r
=
new
cRef
(
ws
.
getRange3
(
r1
,
c1
,
r1
,
c1
).
getName
(),
ws
);
if
(
cElementType
.
number
===
r
.
getValue
().
type
)
{
_sum
+=
r
.
getValue
().
getValue
();
_count
++
;
}
}
i
++
;
}
)
}
else
{
val
=
arg0
.
getValue
();
if
(
matching
(
val
,
valueForSearching
,
oper
)
)
{
var
r
=
arg0
.
getRange
(),
ws
=
arg0
.
getWS
(),
r1
=
r
.
first
.
getRow0
()
+
0
,
c1
=
arg2
.
getRange
().
first
.
getCol0
();
r
=
new
cRef
(
ws
.
getRange3
(
r1
,
c1
,
r1
,
c1
).
getName
(),
ws
);
if
(
r
.
getValue
()
instanceof
cNumber
)
{
_sum
+=
r
.
getValue
().
getValue
();
_count
++
;
}
}
}
if
(
_count
==
0
)
{
return
new
cError
(
cErrorType
.
division_by_zero
);
}
else
{
return
this
.
value
=
new
cNumber
(
_sum
/
_count
);
}
}
cAVERAGEIF
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( cell-range, selection-criteria [ , average-range ] )
"
if
(
_count
==
0
)
{
return
new
cError
(
cErrorType
.
division_by_zero
);
}
else
{
return
this
.
value
=
new
cNumber
(
_sum
/
_count
);
}
};
cAVERAGEIF
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( cell-range, selection-criteria [ , average-range ] )
"
};
};
}
function
cAVERAGEIFS
()
{
cBaseFunction
.
call
(
this
,
"
AVERAGEIFS
"
);
}
function
cAVERAGEIFS
()
{
cBaseFunction
.
call
(
this
,
"
AVERAGEIFS
"
);
}
cAVERAGEIFS
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cAVERAGEIFS
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
function
cBETADIST
()
{
/*Нет реализации в Google Docs*/
cBaseFunction
.
call
(
this
,
"
BETADIST
"
);
}
function
cBETADIST
()
{
/*Нет реализации в Google Docs*/
cBaseFunction
.
call
(
this
,
"
BETADIST
"
);
}
cBETADIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cBETADIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
function
cBETAINV
()
{
/*Нет реализации в Google Docs*/
cBaseFunction
.
call
(
this
,
"
BETAINV
"
);
}
function
cBETAINV
()
{
/*Нет реализации в Google Docs*/
cBaseFunction
.
call
(
this
,
"
BETAINV
"
);
}
cBETAINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cBETAINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
function
cBINOMDIST
()
{
// cBaseFunction.call( this, "BINOMDIST" );
...
...
@@ -724,7 +713,7 @@ function cBINOMDIST() {
}
cBINOMDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cBINOMDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cBINOMDIST
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
arg2
=
arg
[
2
],
arg3
=
arg
[
3
];
...
...
@@ -785,31 +774,31 @@ cBINOMDIST.prototype.Calculate = function ( arg ) {
}
else
return
this
.
value
=
new
cNumber
(
binomdist
(
arg0
.
getValue
(),
arg1
.
getValue
(),
arg2
.
getValue
()
)
);
}
}
;
cBINOMDIST
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( number-successes , number-trials , success-probability , cumulative-flag )
"
};
}
}
;
function
cCHIDIST
()
{
cBaseFunction
.
call
(
this
,
"
CHIDIST
"
);
}
cCHIDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cCHIDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
function
cCHIINV
()
{
cBaseFunction
.
call
(
this
,
"
CHIINV
"
);
}
cCHIINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cCHIINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
function
cCHITEST
()
{
cBaseFunction
.
call
(
this
,
"
CHITEST
"
);
}
cCHITEST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cCHITEST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
function
cCONFIDENCE
()
{
// cBaseFunction.call( this, "CONFIDENCE" );
...
...
@@ -830,7 +819,7 @@ function cCONFIDENCE() {
}
cCONFIDENCE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cCONFIDENCE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cCONFIDENCE
.
prototype
.
Calculate
=
function
(
arg
)
{
var
alpha
=
arg
[
0
],
stdev_sigma
=
arg
[
1
],
size
=
arg
[
2
];
...
...
@@ -868,13 +857,13 @@ cCONFIDENCE.prototype.Calculate = function ( arg ) {
return
this
.
value
=
new
cNumber
(
gaussinv
(
1.0
-
alpha
.
getValue
()
/
2.0
)
*
stdev_sigma
.
getValue
()
/
Math
.
sqrt
(
size
.
getValue
()
)
);
}
}
;
cCONFIDENCE
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( alpha , standard-dev , size )
"
};
}
}
;
function
cCORREL
()
{
// cBaseFunction.call( this, "CORREL" );
...
...
@@ -895,7 +884,7 @@ function cCORREL() {
}
cCORREL
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cCORREL
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cCORREL
.
prototype
.
Calculate
=
function
(
arg
)
{
function
correl
(
x
,
y
)
{
...
...
@@ -961,13 +950,13 @@ cCORREL.prototype.Calculate = function ( arg ) {
return
this
.
value
=
correl
(
arr0
,
arr1
);
}
}
;
cCORREL
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( array-1 , array-2 )
"
};
}
}
;
function
cCOUNT
()
{
// cBaseFunction.call( this, "COUNT" );
...
...
@@ -1112,7 +1101,7 @@ function cCOUNTBLANK() {
}
cCOUNTBLANK
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cCOUNTBLANK
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cCOUNTBLANK
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
];
if
(
arg0
instanceof
cArea
||
arg0
instanceof
cArea3D
)
...
...
@@ -1122,13 +1111,13 @@ cCOUNTBLANK.prototype.Calculate = function ( arg ) {
}
else
return
this
.
value
=
new
cError
(
cErrorType
.
bad_reference
);
}
}
;
cCOUNTBLANK
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( argument-list )
"
};
}
}
;
function
cCOUNTIF
()
{
// cBaseFunction.call( this, "COUNTIF" );
...
...
@@ -1149,7 +1138,7 @@ function cCOUNTIF() {
}
cCOUNTIF
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cCOUNTIF
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cCOUNTIF
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
_count
=
0
,
valueForSearching
;
if
(
!
(
arg0
instanceof
cRef
||
arg0
instanceof
cRef3D
||
arg0
instanceof
cArea
||
arg0
instanceof
cArea3D
)
)
{
...
...
@@ -1198,19 +1187,19 @@ cCOUNTIF.prototype.Calculate = function ( arg ) {
}
return
this
.
value
=
new
cNumber
(
_count
);
}
}
;
cCOUNTIF
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( cell-range, selection-criteria )
"
};
}
}
;
function
cCOUNTIFS
()
{
cBaseFunction
.
call
(
this
,
"
COUNTIFS
"
);
}
cCOUNTIFS
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cCOUNTIFS
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
function
cCOVAR
()
{
// cBaseFunction.call( this, "COVAR" );
...
...
@@ -1231,7 +1220,7 @@ function cCOVAR() {
}
cCOVAR
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cCOVAR
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cCOVAR
.
prototype
.
Calculate
=
function
(
arg
)
{
function
covar
(
x
,
y
)
{
...
...
@@ -1292,13 +1281,13 @@ cCOVAR.prototype.Calculate = function ( arg ) {
return
this
.
value
=
covar
(
arr0
,
arr1
);
}
}
;
cCOVAR
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( array-1 , array-2 )
"
};
}
}
;
function
cCRITBINOM
()
{
// cBaseFunction.call( this, "CRITBINOM" );
...
...
@@ -1319,7 +1308,7 @@ function cCRITBINOM() {
}
cCRITBINOM
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cCRITBINOM
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cCRITBINOM
.
prototype
.
Calculate
=
function
(
arg
)
{
var
n
=
arg
[
0
],
p
=
arg
[
1
],
alpha
=
arg
[
2
];
// alpha
...
...
@@ -1386,13 +1375,13 @@ cCRITBINOM.prototype.Calculate = function ( arg ) {
return
this
.
value
=
critbinom
(
n
,
p
,
alpha
);
}
}
;
cCRITBINOM
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( number-trials , success-probability , alpha )
"
};
}
}
;
function
cDEVSQ
()
{
// cBaseFunction.call( this, "DEVSQ" );
...
...
@@ -1413,7 +1402,7 @@ function cDEVSQ() {
}
cDEVSQ
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cDEVSQ
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cDEVSQ
.
prototype
.
Calculate
=
function
(
arg
)
{
function
devsq
(
x
)
{
...
...
@@ -1474,13 +1463,13 @@ cDEVSQ.prototype.Calculate = function ( arg ) {
}
return
this
.
value
=
devsq
(
arr0
);
}
}
;
cDEVSQ
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( argument-list )
"
};
}
}
;
function
cEXPONDIST
()
{
// cBaseFunction.call( this, "EXPONDIST" );
...
...
@@ -1501,7 +1490,7 @@ function cEXPONDIST() {
}
cEXPONDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cEXPONDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cEXPONDIST
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
arg2
=
arg
[
2
],
arg3
=
arg
[
3
];
...
...
@@ -1542,25 +1531,25 @@ cEXPONDIST.prototype.Calculate = function ( arg ) {
}
else
return
this
.
value
=
new
cNumber
(
arg1
.
getValue
()
*
Math
.
exp
(
-
arg1
.
getValue
()
*
arg0
.
getValue
()
)
);
}
}
;
cEXPONDIST
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( x , lambda , cumulative-flag )
"
};
}
}
;
function
cFDIST
()
{
cBaseFunction
.
call
(
this
,
"
FDIST
"
);
}
cFDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cFDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
function
cFINV
()
{
cBaseFunction
.
call
(
this
,
"
FINV
"
);
}
cFINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cFINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
function
cFISHER
()
{
// cBaseFunction.call( this, "FISHER" );
...
...
@@ -1581,7 +1570,7 @@ function cFISHER() {
}
cFISHER
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cFISHER
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cFISHER
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
];
...
...
@@ -1612,13 +1601,13 @@ cFISHER.prototype.Calculate = function ( arg ) {
}
return
this
.
value
=
arg0
;
}
}
;
cFISHER
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( number )
"
};
}
}
;
function
cFISHERINV
()
{
// cBaseFunction.call( this, "FISHERINV" );
...
...
@@ -1639,7 +1628,7 @@ function cFISHERINV() {
}
cFISHERINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cFISHERINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cFISHERINV
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
];
...
...
@@ -1670,13 +1659,13 @@ cFISHERINV.prototype.Calculate = function ( arg ) {
}
return
this
.
value
=
arg0
;
}
}
;
cFISHERINV
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( number )
"
};
}
}
;
function
cFORECAST
()
{
// cBaseFunction.call( this, "FORECAST" );
...
...
@@ -1804,7 +1793,7 @@ function cFREQUENCY() {
}
cFREQUENCY
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cFREQUENCY
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cFREQUENCY
.
prototype
.
Calculate
=
function
(
arg
)
{
function
frequency
(
A
,
B
)
{
...
...
@@ -2073,7 +2062,7 @@ function cHARMEAN() {
}
cHARMEAN
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cHARMEAN
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cHARMEAN
.
prototype
.
Calculate
=
function
(
arg
)
{
function
harmmean
(
x
)
{
...
...
@@ -2162,7 +2151,7 @@ function cHYPGEOMDIST() {
}
cHYPGEOMDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cHYPGEOMDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cHYPGEOMDIST
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
arg2
=
arg
[
2
],
arg3
=
arg
[
3
];
...
...
@@ -2216,13 +2205,13 @@ cHYPGEOMDIST.prototype.Calculate = function ( arg ) {
return
this
.
value
=
new
cNumber
(
Math
.
binomCoeff
(
arg2
.
getValue
(),
arg0
.
getValue
()
)
*
Math
.
binomCoeff
(
arg3
.
getValue
()
-
arg2
.
getValue
(),
arg1
.
getValue
()
-
arg0
.
getValue
()
)
/
Math
.
binomCoeff
(
arg3
.
getValue
(),
arg1
.
getValue
()
)
);
}
}
;
cHYPGEOMDIST
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( sample-successes , number-sample , population-successes , number-population )
"
};
}
}
;
function
cINTERCEPT
()
{
// cBaseFunction.call( this, "INTERCEPT" );
...
...
@@ -2243,7 +2232,7 @@ function cINTERCEPT() {
}
cINTERCEPT
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cINTERCEPT
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cINTERCEPT
.
prototype
.
Calculate
=
function
(
arg
)
{
function
intercept
(
y
,
x
)
{
...
...
@@ -2338,7 +2327,7 @@ function cKURT() {
}
cKURT
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cKURT
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cKURT
.
prototype
.
Calculate
=
function
(
arg
)
{
function
kurt
(
x
)
{
...
...
@@ -2438,7 +2427,7 @@ function cLARGE() {
}
cLARGE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cLARGE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cLARGE
.
prototype
.
Calculate
=
function
(
arg
)
{
function
frequency
(
A
,
k
)
{
...
...
@@ -2503,13 +2492,13 @@ function cLINEST() {
cBaseFunction
.
call
(
this
,
"
LINEST
"
);
}
cLINEST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cLINEST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
function
cLOGEST
()
{
cBaseFunction
.
call
(
this
,
"
LOGEST
"
);
}
cLOGEST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cLOGEST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
function
cLOGINV
()
{
// cBaseFunction.call( this, "LOGINV" );
...
...
@@ -2530,7 +2519,7 @@ function cLOGINV() {
}
cLOGINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cLOGINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cLOGINV
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
arg2
=
arg
[
2
];
...
...
@@ -2572,13 +2561,13 @@ cLOGINV.prototype.Calculate = function ( arg ) {
if
(
arg2
instanceof
cError
)
return
this
.
value
=
arg2
;
return
this
.
value
=
loginv
(
arg0
.
getValue
(),
arg1
.
getValue
(),
arg2
.
getValue
()
);
}
}
;
cLOGINV
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( x , mean , standard-deviation )
"
};
}
}
;
function
cLOGNORMDIST
()
{
// cBaseFunction.call( this, "LOGNORMDIST" );
...
...
@@ -2599,7 +2588,7 @@ function cLOGNORMDIST() {
}
cLOGNORMDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cLOGNORMDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cLOGNORMDIST
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
arg2
=
arg
[
2
];
...
...
@@ -2641,13 +2630,13 @@ cLOGNORMDIST.prototype.Calculate = function ( arg ) {
if
(
arg2
instanceof
cError
)
return
this
.
value
=
arg2
;
return
this
.
value
=
normdist
(
arg0
.
getValue
(),
arg1
.
getValue
(),
arg2
.
getValue
()
);
}
}
;
cLOGNORMDIST
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( x , mean , standard-deviation )
"
};
}
}
;
function
cMAX
()
{
// cBaseFunction.call( this, "MAX" );
...
...
@@ -2756,7 +2745,7 @@ function cMAXA() {
}
cMAXA
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cMAXA
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cMAXA
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argI
,
argIVal
,
max
=
Number
.
NEGATIVE_INFINITY
;
for
(
var
i
=
0
;
i
<
this
.
argumentsCurrent
;
i
++
)
{
...
...
@@ -2825,7 +2814,7 @@ cMAXA.prototype.getInfo = function () {
name
:
this
.
name
,
args
:
"
(number1, number2, ...)
"
};
}
}
;
function
cMEDIAN
()
{
// cBaseFunction.call( this, "MEDIAN" );
...
...
@@ -2846,7 +2835,7 @@ function cMEDIAN() {
}
cMEDIAN
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cMEDIAN
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cMEDIAN
.
prototype
.
Calculate
=
function
(
arg
)
{
function
median
(
x
)
{
...
...
@@ -2932,7 +2921,7 @@ function cMIN() {
}
cMIN
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cMIN
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cMIN
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argI
,
argIVal
,
min
=
Number
.
POSITIVE_INFINITY
;
for
(
var
i
=
0
;
i
<
this
.
argumentsCurrent
;
i
++
)
{
...
...
@@ -3000,7 +2989,7 @@ cMIN.prototype.getInfo = function () {
name
:
this
.
name
,
args
:
"
(number1, number2, ...)
"
};
}
}
;
function
cMINA
()
{
// cBaseFunction.call( this, "MINA" );
...
...
@@ -3021,7 +3010,7 @@ function cMINA() {
}
cMINA
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cMINA
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cMINA
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argI
,
argIVal
,
min
=
Number
.
POSITIVE_INFINITY
;
for
(
var
i
=
0
;
i
<
this
.
argumentsCurrent
;
i
++
)
{
...
...
@@ -3092,7 +3081,7 @@ cMINA.prototype.getInfo = function () {
name
:
this
.
name
,
args
:
"
(number1, number2, ...)
"
};
}
}
;
function
cMODE
()
{
// cBaseFunction.call( this, "MODE" );
...
...
@@ -3113,7 +3102,7 @@ function cMODE() {
}
cMODE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cMODE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cMODE
.
prototype
.
Calculate
=
function
(
arg
)
{
function
mode
(
x
)
{
...
...
@@ -3219,7 +3208,7 @@ function cNEGBINOMDIST() {
}
cNEGBINOMDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cNEGBINOMDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cNEGBINOMDIST
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
arg2
=
arg
[
2
];
...
...
@@ -3264,13 +3253,13 @@ cNEGBINOMDIST.prototype.Calculate = function ( arg ) {
return
this
.
value
=
negbinomdist
(
arg0
,
arg1
,
arg2
);
}
}
;
cNEGBINOMDIST
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( number-failures , number-successes , success-probability )
"
};
}
}
;
function
cNORMDIST
()
{
// cBaseFunction.call( this, "NORMDIST" );
...
...
@@ -3291,7 +3280,7 @@ function cNORMDIST() {
}
cNORMDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cNORMDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cNORMDIST
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
arg2
=
arg
[
2
],
arg3
=
arg
[
3
];
...
...
@@ -3347,13 +3336,13 @@ cNORMDIST.prototype.Calculate = function ( arg ) {
return
this
.
value
=
normdist
(
arg0
.
getValue
(),
arg1
.
getValue
(),
arg2
.
getValue
(),
arg3
.
toBool
()
);
}
}
;
cNORMDIST
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( x , mean , standard-deviation , cumulative-flag )
"
};
}
}
;
function
cNORMINV
()
{
// cBaseFunction.call( this, "NORMINV" );
...
...
@@ -3374,7 +3363,7 @@ function cNORMINV() {
}
cNORMINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cNORMINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cNORMINV
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
arg2
=
arg
[
2
];
...
...
@@ -3416,13 +3405,13 @@ cNORMINV.prototype.Calculate = function ( arg ) {
if
(
arg2
instanceof
cError
)
return
this
.
value
=
arg2
;
return
this
.
value
=
norminv
(
arg0
.
getValue
(),
arg1
.
getValue
(),
arg2
.
getValue
()
);
}
}
;
cNORMINV
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( x , mean , standard-deviation )
"
};
}
}
;
function
cNORMSDIST
()
{
// cBaseFunction.call( this, "NORMSDIST" );
...
...
@@ -3443,7 +3432,7 @@ function cNORMSDIST() {
}
cNORMSDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cNORMSDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cNORMSDIST
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
];
if
(
arg0
instanceof
cArea
||
arg0
instanceof
cArea3D
)
{
...
...
@@ -3468,13 +3457,13 @@ cNORMSDIST.prototype.Calculate = function ( arg ) {
return
this
.
value
=
isNaN
(
a
)
?
new
cError
(
cErrorType
.
not_numeric
)
:
new
cNumber
(
a
);
}
return
this
.
value
=
arg0
;
}
}
;
cNORMSDIST
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
(number)
"
};
}
}
;
function
cNORMSINV
()
{
// cBaseFunction.call( this, "NORMSINV" );
...
...
@@ -3495,7 +3484,7 @@ function cNORMSINV() {
}
cNORMSINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cNORMSINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cNORMSINV
.
prototype
.
Calculate
=
function
(
arg
)
{
function
normsinv
(
x
)
{
...
...
@@ -3528,13 +3517,13 @@ cNORMSINV.prototype.Calculate = function ( arg ) {
return
this
.
value
=
isNaN
(
a
)
?
new
cError
(
cErrorType
.
not_available
)
:
new
cNumber
(
a
);
}
return
this
.
value
=
arg0
;
}
}
;
cNORMSINV
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( probability )
"
};
}
}
;
function
cPEARSON
()
{
// cBaseFunction.call( this, "PEARSON" );
...
...
@@ -3555,7 +3544,7 @@ function cPEARSON() {
}
cPEARSON
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cPEARSON
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cPEARSON
.
prototype
.
Calculate
=
function
(
arg
)
{
function
pearson
(
x
,
y
)
{
...
...
@@ -3650,7 +3639,7 @@ function cPERCENTILE() {
}
cPERCENTILE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cPERCENTILE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cPERCENTILE
.
prototype
.
Calculate
=
function
(
arg
)
{
function
percentile
(
A
,
k
)
{
...
...
@@ -3723,7 +3712,7 @@ cPERCENTILE.prototype.getInfo = function () {
name
:
this
.
name
,
args
:
"
( array , k )
"
};
}
}
;
function
cPERCENTRANK
()
{
// cBaseFunction.call( this, "PERCENTRANK" );
...
...
@@ -3744,7 +3733,7 @@ function cPERCENTRANK() {
}
cPERCENTRANK
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cPERCENTRANK
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cPERCENTRANK
.
prototype
.
Calculate
=
function
(
arg
)
{
function
percentrank
(
A
,
x
,
k
)
{
...
...
@@ -3840,13 +3829,13 @@ cPERCENTRANK.prototype.Calculate = function ( arg ) {
return
this
.
value
=
percentrank
(
arr0
,
arg1
,
arg2
);
}
}
;
cPERCENTRANK
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( array , x [ , significance ] )
"
};
}
}
;
function
cPERMUT
()
{
// cBaseFunction.call( this, "PERMUT" );
...
...
@@ -3867,7 +3856,7 @@ function cPERMUT() {
}
cPERMUT
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cPERMUT
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cPERMUT
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
];
if
(
arg0
instanceof
cArea
||
arg0
instanceof
cArea3D
)
{
...
...
@@ -3937,13 +3926,13 @@ cPERMUT.prototype.Calculate = function ( arg ) {
return
this
.
value
=
new
cError
(
cErrorType
.
not_numeric
);
return
this
.
value
=
new
cNumber
(
Math
.
permut
(
arg0
.
getValue
(),
arg1
.
getValue
()
)
);
}
}
;
cPERMUT
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( number , number-chosen )
"
};
}
}
;
function
cPOISSON
()
{
// cBaseFunction.call( this, "POISSON" );
...
...
@@ -3964,7 +3953,7 @@ function cPOISSON() {
}
cPOISSON
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cPOISSON
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cPOISSON
.
prototype
.
Calculate
=
function
(
arg
)
{
function
poisson
(
x
,
l
,
cumulativeFlag
)
{
...
...
@@ -4020,13 +4009,13 @@ cPOISSON.prototype.Calculate = function ( arg ) {
return
this
.
value
=
new
cNumber
(
poisson
(
arg0
,
arg1
,
arg2
)
);
}
}
;
cPOISSON
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( x , mean , cumulative-flag )
"
};
}
}
;
function
cPROB
()
{
// cBaseFunction.call( this, "PROB" );
...
...
@@ -4048,7 +4037,7 @@ function cPROB() {
}
cPROB
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cPROB
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cPROB
.
prototype
.
Calculate
=
function
(
arg
)
{
function
prob
(
x
,
p
,
l
,
u
)
{
...
...
@@ -4169,7 +4158,7 @@ function cQUARTILE() {
}
cQUARTILE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cQUARTILE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cQUARTILE
.
prototype
.
Calculate
=
function
(
arg
)
{
function
quartile
(
A
,
k
)
{
...
...
@@ -4826,7 +4815,7 @@ function cSTDEVA() {
}
cSTDEVA
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cSTDEVA
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cSTDEVA
.
prototype
.
Calculate
=
function
(
arg
)
{
var
count
=
0
,
sum
=
new
cNumber
(
0
),
member
=
[];
for
(
var
i
=
0
;
i
<
arg
.
length
;
i
++
)
{
...
...
@@ -4991,7 +4980,7 @@ function cSTDEVPA() {
}
cSTDEVPA
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cSTDEVPA
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cSTDEVPA
.
prototype
.
Calculate
=
function
(
arg
)
{
function
_var
(
x
)
{
...
...
@@ -5100,7 +5089,7 @@ function cSTEYX() {
}
cSTEYX
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cSTEYX
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
cSTEYX
.
prototype
.
Calculate
=
function
(
arg
)
{
function
steyx
(
y
,
x
)
{
...
...
@@ -5181,19 +5170,19 @@ function cTDIST() {
cBaseFunction
.
call
(
this
,
"
TDIST
"
);
}
cTDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cTDIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
function
cTINV
()
{
cBaseFunction
.
call
(
this
,
"
TINV
"
);
}
cTINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cTINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
function
cTREND
()
{
cBaseFunction
.
call
(
this
,
"
TREND
"
);
}
cTREND
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
cTREND
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
)
;
function
cTRIMMEAN
()
{
cBaseFunction
.
call
(
this
,
"
TRIMMEAN
"
);
...
...
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