Commit 46530936 authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov Committed by Alexander.Trofimov

добавлены функции:

AVEDEV, AVERAGEA, AVERAGEIF, BINOMDIST, CONFIDENCE, CORREL, COUNTA, COVAR, CRITBINOM
поправлены:
AVERAGE, MAX, MAXA, MIN, MINA

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48607 954022d7-b5bf-4e40-9824-e11837661b57
parent cf729774
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3026,7 +3026,7 @@ cFormulaFunction.Mathematic = {
r.setArgumentsMin( 2 );
r.setArgumentsMax( 3 );
r.Calculate = function ( arg ) {
var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2] ? arg[2] : arg[0], _count = 0, valueForSearching, regexpSearch;
var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2] ? arg[2] : arg[0], _sum = 0, valueForSearching, regexpSearch;
if ( !(arg0 instanceof cRef || arg0 instanceof cRef3D || arg0 instanceof cArea) ) {
return this.value = new cError( cErrorType.wrong_value_type );
}
......@@ -3077,11 +3077,11 @@ cFormulaFunction.Mathematic = {
}
arg1 = arg1.toString();
var operators = new RegExp( "^ *[<=> ]+ *" ), searchOperators = new RegExp( "^ *[*?]" )
var operators = new RegExp( "^ *[<=> ]+ *" );
var match = arg1.match( operators );
if ( match || parseNum( arg1 ) ) {
var search, oper, val, calcVal;
var search, oper, val;
if ( match ) {
search = arg1.substr( match[0].length );
oper = match[0].replace( /\s/g, "" );
......@@ -3098,7 +3098,7 @@ cFormulaFunction.Mathematic = {
r1 = r.first.getRow0() + i, c1 = arg2.getRange().first.getCol0();
r = new cRef( ws.getRange3( r1, c1, r1, c1 ).getName(), ws );
if ( r.getValue() instanceof cNumber ) {
_count += r.getValue().getValue();
_sum += r.getValue().getValue();
}
}
}
......@@ -3110,7 +3110,7 @@ cFormulaFunction.Mathematic = {
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 ) {
_count += r.getValue().getValue();
_sum += r.getValue().getValue();
}
}
}
......@@ -3133,7 +3133,7 @@ cFormulaFunction.Mathematic = {
r1 = r.first.getRow0() + i, c1 = arg2.getRange().first.getCol0();
r = new cRef( ws.getRange3( r1, c1, r1, c1 ).getName(), ws );
if ( r.getValue() instanceof cNumber ) {
_count += r.getValue().getValue();
_sum += r.getValue().getValue();
}
}
}
......@@ -3145,18 +3145,18 @@ cFormulaFunction.Mathematic = {
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 ) {
_count += r.getValue().getValue();
_sum += r.getValue().getValue();
}
}
}
}
return this.value = new cNumber( _count );
return this.value = new cNumber( _sum );
}
r.getInfo = function () {
return {
name:this.name,
args:"( cell-range, selection-criteria )"
args:"( cell-range, selection-criteria [ , sum-range ] )"
};
}
return r;
......
......@@ -1531,6 +1531,10 @@ function cNumber( val ) {
cNumber.superclass.constructor.call( this, val );
this.type = cElementType.number;
this.value = parseFloat( val );
if( !isNaN( this.value ) && Math.abs(this.value)!=Infinity )
return this;
else
return new cError( cErrorType.not_numeric );
}
extend( cNumber, cBaseType );
cNumber.prototype.getValue = function () {
......@@ -1587,12 +1591,10 @@ function cBool( val ) {
this.type = cElementType.bool;
var that = this;
switch ( val.toString().toUpperCase() ) {
case "TRUE"/* ||true */
:
case "TRUE":
this.value = true;
break;
case "FALSE"/* ||false */
:
case "FALSE":
this.value = false;
break;
}
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment