Commit c230346e authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix bug 32527

parent 202fc9d6
...@@ -2622,14 +2622,14 @@ function cPRODUCT() { ...@@ -2622,14 +2622,14 @@ function cPRODUCT() {
} }
cPRODUCT.prototype = Object.create( cBaseFunction.prototype ) cPRODUCT.prototype = Object.create( cBaseFunction.prototype );
cPRODUCT.prototype.Calculate = function ( arg ) { cPRODUCT.prototype.Calculate = function ( arg ) {
var arg0 = new cNumber( 1 ); var arg0 = new cNumber( 1 );
for ( var i = 0; i < arg.length; i++ ) { for ( var i = 0; i < arg.length; i++ ) {
if ( arg[i] instanceof cArea || arg[i] instanceof cArea3D ) { if ( arg[i] instanceof cArea || arg[i] instanceof cArea3D ) {
var _arrVal = arg[i].getValue(); var _arrVal = arg[i].getValue();
for ( var j = 0; j < _arrVal.length; j++ ) { for ( var j = 0; j < _arrVal.length; j++ ) {
arg0 = _func[arg0.type][_arrVal[j].type]( arg0, _arrVal[j], "*" ) arg0 = _func[arg0.type][_arrVal[j].type]( arg0, _arrVal[j], "*" );
if ( arg0 instanceof cError ) if ( arg0 instanceof cError )
return this.value = arg0; return this.value = arg0;
} }
...@@ -2655,13 +2655,13 @@ cPRODUCT.prototype.Calculate = function ( arg ) { ...@@ -2655,13 +2655,13 @@ cPRODUCT.prototype.Calculate = function ( arg ) {
} }
return this.value = arg0; return this.value = arg0;
} };
cPRODUCT.prototype.getInfo = function () { cPRODUCT.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cQUOTIENT() { function cQUOTIENT() {
// cBaseFunction.call( this, "QUOTIENT" ); // cBaseFunction.call( this, "QUOTIENT" );
...@@ -3808,7 +3808,7 @@ function cSUBTOTAL() { ...@@ -3808,7 +3808,7 @@ function cSUBTOTAL() {
this.setArgumentsMax( 255 ); this.setArgumentsMax( 255 );
} }
cSUBTOTAL.prototype = Object.create( cBaseFunction.prototype ) cSUBTOTAL.prototype = Object.create( cBaseFunction.prototype );
cSUBTOTAL.prototype.Calculate = function ( arg ) { cSUBTOTAL.prototype.Calculate = function ( arg ) {
var f, arg0 = arg[0]; var f, arg0 = arg[0];
...@@ -3900,7 +3900,7 @@ function cSUM() { ...@@ -3900,7 +3900,7 @@ function cSUM() {
} }
cSUM.prototype = Object.create( cBaseFunction.prototype ) cSUM.prototype = Object.create( cBaseFunction.prototype );
cSUM.prototype.Calculate = function ( arg ) { cSUM.prototype.Calculate = function ( arg ) {
var arg0 = new cNumber( 0 ); var arg0 = new cNumber( 0 );
for ( var i = 0; i < arg.length; i++ ) { for ( var i = 0; i < arg.length; i++ ) {
...@@ -3908,7 +3908,7 @@ cSUM.prototype.Calculate = function ( arg ) { ...@@ -3908,7 +3908,7 @@ cSUM.prototype.Calculate = function ( arg ) {
var _arrVal = arg[i].getValue(); var _arrVal = arg[i].getValue();
for ( var j = 0; j < _arrVal.length; j++ ) { for ( var j = 0; j < _arrVal.length; j++ ) {
if ( !(_arrVal[j] instanceof cBool || _arrVal[j] instanceof cString) ) if ( !(_arrVal[j] instanceof cBool || _arrVal[j] instanceof cString) )
arg0 = _func[arg0.type][_arrVal[j].type]( arg0, _arrVal[j], "+" ) arg0 = _func[arg0.type][_arrVal[j].type]( arg0, _arrVal[j], "+" );
if ( arg0 instanceof cError ) if ( arg0 instanceof cError )
return this.value = arg0; return this.value = arg0;
} }
...@@ -3936,13 +3936,13 @@ cSUM.prototype.Calculate = function ( arg ) { ...@@ -3936,13 +3936,13 @@ cSUM.prototype.Calculate = function ( arg ) {
} }
return this.value = arg0; return this.value = arg0;
} };
cSUM.prototype.getInfo = function () { cSUM.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cSUMIF() { function cSUMIF() {
// cBaseFunction.call( this, "SUMIF" ); // cBaseFunction.call( this, "SUMIF" );
......
...@@ -435,7 +435,7 @@ function cAVERAGE() { ...@@ -435,7 +435,7 @@ function cAVERAGE() {
} }
cAVERAGE.prototype = Object.create( cBaseFunction.prototype ) cAVERAGE.prototype = Object.create( cBaseFunction.prototype );
cAVERAGE.prototype.Calculate = function ( arg ) { cAVERAGE.prototype.Calculate = function ( arg ) {
var count = 0, sum = new cNumber( 0 ); var count = 0, sum = new cNumber( 0 );
for ( var i = 0; i < arg.length; i++ ) { for ( var i = 0; i < arg.length; i++ ) {
...@@ -496,7 +496,7 @@ cAVERAGE.prototype.getInfo = function () { ...@@ -496,7 +496,7 @@ cAVERAGE.prototype.getInfo = function () {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cAVERAGEA() { function cAVERAGEA() {
// cBaseFunction.call( this, "AVERAGEA" ); // cBaseFunction.call( this, "AVERAGEA" );
...@@ -517,7 +517,7 @@ function cAVERAGEA() { ...@@ -517,7 +517,7 @@ function cAVERAGEA() {
} }
cAVERAGEA.prototype = Object.create( cBaseFunction.prototype ) cAVERAGEA.prototype = Object.create( cBaseFunction.prototype );
cAVERAGEA.prototype.Calculate = function ( arg ) { cAVERAGEA.prototype.Calculate = function ( arg ) {
var count = 0, sum = new cNumber( 0 ); var count = 0, sum = new cNumber( 0 );
for ( var i = 0; i < arg.length; i++ ) { for ( var i = 0; i < arg.length; i++ ) {
...@@ -580,7 +580,7 @@ cAVERAGEA.prototype.getInfo = function () { ...@@ -580,7 +580,7 @@ cAVERAGEA.prototype.getInfo = function () {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cAVERAGEIF() { function cAVERAGEIF() {
// cBaseFunction.call( this, "AVERAGEIF", 2, 3 ); // cBaseFunction.call( this, "AVERAGEIF", 2, 3 );
...@@ -946,7 +946,7 @@ cCORREL.prototype.Calculate = function ( arg ) { ...@@ -946,7 +946,7 @@ cCORREL.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
if ( arg1 instanceof cArea ) { if ( arg1 instanceof cArea ) {
arr1 = arg1.getValue(); arr1 = arg1.getValue();
...@@ -957,7 +957,7 @@ cCORREL.prototype.Calculate = function ( arg ) { ...@@ -957,7 +957,7 @@ cCORREL.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
return this.value = correl( arr0, arr1 ); return this.value = correl( arr0, arr1 );
...@@ -989,7 +989,7 @@ function cCOUNT() { ...@@ -989,7 +989,7 @@ function cCOUNT() {
} }
cCOUNT.prototype = Object.create( cBaseFunction.prototype ) cCOUNT.prototype = Object.create( cBaseFunction.prototype );
cCOUNT.prototype.Calculate = function ( arg ) { cCOUNT.prototype.Calculate = function ( arg ) {
var count = 0; var count = 0;
for ( var i = 0; i < arg.length; i++ ) { for ( var i = 0; i < arg.length; i++ ) {
...@@ -1031,7 +1031,7 @@ cCOUNT.prototype.getInfo = function () { ...@@ -1031,7 +1031,7 @@ cCOUNT.prototype.getInfo = function () {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cCOUNTA() { function cCOUNTA() {
// cBaseFunction.call( this, "COUNTA" ); // cBaseFunction.call( this, "COUNTA" );
...@@ -1053,7 +1053,7 @@ function cCOUNTA() { ...@@ -1053,7 +1053,7 @@ function cCOUNTA() {
} }
cCOUNTA.prototype = Object.create( cBaseFunction.prototype ) cCOUNTA.prototype = Object.create( cBaseFunction.prototype );
cCOUNTA.prototype.Calculate = function ( arg ) { cCOUNTA.prototype.Calculate = function ( arg ) {
var count = 0; var count = 0;
for ( var i = 0; i < arg.length; i++ ) { for ( var i = 0; i < arg.length; i++ ) {
...@@ -1090,7 +1090,7 @@ cCOUNTA.prototype.getInfo = function () { ...@@ -1090,7 +1090,7 @@ cCOUNTA.prototype.getInfo = function () {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cCOUNTBLANK() { function cCOUNTBLANK() {
// cBaseFunction.call( this, "COUNTBLANK" ); // cBaseFunction.call( this, "COUNTBLANK" );
...@@ -1277,7 +1277,7 @@ cCOVAR.prototype.Calculate = function ( arg ) { ...@@ -1277,7 +1277,7 @@ cCOVAR.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
if ( arg1 instanceof cArea ) { if ( arg1 instanceof cArea ) {
arr1 = arg1.getValue(); arr1 = arg1.getValue();
...@@ -1288,7 +1288,7 @@ cCOVAR.prototype.Calculate = function ( arg ) { ...@@ -1288,7 +1288,7 @@ cCOVAR.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
return this.value = covar( arr0, arr1 ); return this.value = covar( arr0, arr1 );
...@@ -1469,7 +1469,7 @@ cDEVSQ.prototype.Calculate = function ( arg ) { ...@@ -1469,7 +1469,7 @@ cDEVSQ.prototype.Calculate = function ( arg ) {
continue; continue;
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
} }
return this.value = devsq( arr0 ); return this.value = devsq( arr0 );
...@@ -1761,7 +1761,7 @@ cFORECAST.prototype.Calculate = function ( arg ) { ...@@ -1761,7 +1761,7 @@ cFORECAST.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
if ( arg2 instanceof cArea ) { if ( arg2 instanceof cArea ) {
arr1 = arg2.getValue(); arr1 = arg2.getValue();
...@@ -1772,17 +1772,17 @@ cFORECAST.prototype.Calculate = function ( arg ) { ...@@ -1772,17 +1772,17 @@ cFORECAST.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
return this.value = forecast( arg0, arr0, arr1 ); return this.value = forecast( arg0, arr0, arr1 );
} };
cFORECAST.prototype.getInfo = function () { cFORECAST.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x , array-1 , array-2 )" args:"( x , array-1 , array-2 )"
}; };
} };
function cFREQUENCY() { function cFREQUENCY() {
// cBaseFunction.call( this, "FREQUENCY" ); // cBaseFunction.call( this, "FREQUENCY" );
...@@ -2035,7 +2035,7 @@ cGEOMEAN.prototype.Calculate = function ( arg ) { ...@@ -2035,7 +2035,7 @@ cGEOMEAN.prototype.Calculate = function ( arg ) {
arr0.push( arg[j].tocNumber() ); arr0.push( arg[j].tocNumber() );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
} }
return this.value = geommean( arr0 ); return this.value = geommean( arr0 );
...@@ -2130,18 +2130,18 @@ cHARMEAN.prototype.Calculate = function ( arg ) { ...@@ -2130,18 +2130,18 @@ cHARMEAN.prototype.Calculate = function ( arg ) {
arr0.push( arg[j].tocNumber() ); arr0.push( arg[j].tocNumber() );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
} }
return this.value = harmmean( arr0 ); return this.value = harmmean( arr0 );
} };
cHARMEAN.prototype.getInfo = function () { cHARMEAN.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cHYPGEOMDIST() { function cHYPGEOMDIST() {
// cBaseFunction.call( this, "HYPGEOMDIST" ); // cBaseFunction.call( this, "HYPGEOMDIST" );
...@@ -2296,7 +2296,7 @@ cINTERCEPT.prototype.Calculate = function ( arg ) { ...@@ -2296,7 +2296,7 @@ cINTERCEPT.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
if ( arg1 instanceof cArea ) { if ( arg1 instanceof cArea ) {
arr1 = arg1.getValue(); arr1 = arg1.getValue();
...@@ -2307,17 +2307,17 @@ cINTERCEPT.prototype.Calculate = function ( arg ) { ...@@ -2307,17 +2307,17 @@ cINTERCEPT.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
return this.value = intercept( arr0, arr1 ); return this.value = intercept( arr0, arr1 );
} };
cINTERCEPT.prototype.getInfo = function () { cINTERCEPT.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( array-1 , array-2 )" args:"( array-1 , array-2 )"
}; };
} };
function cKURT() { function cKURT() {
// cBaseFunction.call( this, "KURT" ); // cBaseFunction.call( this, "KURT" );
...@@ -2405,18 +2405,18 @@ cKURT.prototype.Calculate = function ( arg ) { ...@@ -2405,18 +2405,18 @@ cKURT.prototype.Calculate = function ( arg ) {
continue; continue;
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
} }
return this.value = kurt( arr0 ); return this.value = kurt( arr0 );
} };
cKURT.prototype.getInfo = function () { cKURT.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cLARGE() { function cLARGE() {
// cBaseFunction.call( this, "LARGE" ); // cBaseFunction.call( this, "LARGE" );
...@@ -2668,7 +2668,7 @@ function cMAX() { ...@@ -2668,7 +2668,7 @@ function cMAX() {
} }
cMAX.prototype = Object.create( cBaseFunction.prototype ) cMAX.prototype = Object.create( cBaseFunction.prototype );
cMAX.prototype.Calculate = function ( arg ) { cMAX.prototype.Calculate = function ( arg ) {
var argI, argIVal, max = Number.NEGATIVE_INFINITY; var argI, argIVal, max = Number.NEGATIVE_INFINITY;
for ( var i = 0; i < this.argumentsCurrent; i++ ) { for ( var i = 0; i < this.argumentsCurrent; i++ ) {
...@@ -2718,7 +2718,7 @@ cMAX.prototype.Calculate = function ( arg ) { ...@@ -2718,7 +2718,7 @@ cMAX.prototype.Calculate = function ( arg ) {
max = elem; max = elem;
return true; return true;
} }
} ) } );
if ( max instanceof cError ) { if ( max instanceof cError ) {
return this.value = max; return this.value = max;
} }
...@@ -2735,7 +2735,7 @@ cMAX.prototype.getInfo = function () { ...@@ -2735,7 +2735,7 @@ cMAX.prototype.getInfo = function () {
name:this.name, name:this.name,
args:"(number1, number2, ...)" args:"(number1, number2, ...)"
}; };
} };
function cMAXA() { function cMAXA() {
// cBaseFunction.call( this, "MAXA" ); // cBaseFunction.call( this, "MAXA" );
...@@ -2900,18 +2900,18 @@ cMEDIAN.prototype.Calculate = function ( arg ) { ...@@ -2900,18 +2900,18 @@ cMEDIAN.prototype.Calculate = function ( arg ) {
continue; continue;
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
} }
return this.value = median( arr0 ); return this.value = median( arr0 );
} };
cMEDIAN.prototype.getInfo = function () { cMEDIAN.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cMIN() { function cMIN() {
// cBaseFunction.call( this, "MIN" ); // cBaseFunction.call( this, "MIN" );
...@@ -3187,18 +3187,18 @@ cMODE.prototype.Calculate = function ( arg ) { ...@@ -3187,18 +3187,18 @@ cMODE.prototype.Calculate = function ( arg ) {
continue; continue;
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
} }
return this.value = mode( arr0 ); return this.value = mode( arr0 );
} };
cMODE.prototype.getInfo = function () { cMODE.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cNEGBINOMDIST() { function cNEGBINOMDIST() {
// cBaseFunction.call( this, "NEGBINOMDIST" ); // cBaseFunction.call( this, "NEGBINOMDIST" );
...@@ -3607,7 +3607,7 @@ cPEARSON.prototype.Calculate = function ( arg ) { ...@@ -3607,7 +3607,7 @@ cPEARSON.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
if ( arg1 instanceof cArea ) { if ( arg1 instanceof cArea ) {
arr1 = arg1.getValue(); arr1 = arg1.getValue();
...@@ -3618,17 +3618,17 @@ cPEARSON.prototype.Calculate = function ( arg ) { ...@@ -3618,17 +3618,17 @@ cPEARSON.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
return this.value = pearson( arr0, arr1 ); return this.value = pearson( arr0, arr1 );
} };
cPEARSON.prototype.getInfo = function () { cPEARSON.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( array-1 , array-2 )" args:"( array-1 , array-2 )"
}; };
} };
function cPERCENTILE() { function cPERCENTILE() {
// cBaseFunction.call( this, "PERCENTILE" ); // cBaseFunction.call( this, "PERCENTILE" );
...@@ -4350,7 +4350,7 @@ cRSQ.prototype.Calculate = function ( arg ) { ...@@ -4350,7 +4350,7 @@ cRSQ.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ); return this.value = new cError( cErrorType.wrong_value_type );
if ( arg1 instanceof cArea ) { if ( arg1 instanceof cArea ) {
arr1 = arg1.getValue(); arr1 = arg1.getValue();
...@@ -4361,7 +4361,7 @@ cRSQ.prototype.Calculate = function ( arg ) { ...@@ -4361,7 +4361,7 @@ cRSQ.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ); return this.value = new cError( cErrorType.wrong_value_type );
return this.value = rsq( arr0, arr1 ); return this.value = rsq( arr0, arr1 );
...@@ -4463,7 +4463,7 @@ cSKEW.prototype.Calculate = function ( arg ) { ...@@ -4463,7 +4463,7 @@ cSKEW.prototype.Calculate = function ( arg ) {
continue; continue;
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
} }
return this.value = skew( arr0 ); return this.value = skew( arr0 );
...@@ -4547,7 +4547,7 @@ cSLOPE.prototype.Calculate = function ( arg ) { ...@@ -4547,7 +4547,7 @@ cSLOPE.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
if ( arg1 instanceof cArea ) { if ( arg1 instanceof cArea ) {
arr1 = arg1.getValue(); arr1 = arg1.getValue();
...@@ -4558,7 +4558,7 @@ cSLOPE.prototype.Calculate = function ( arg ) { ...@@ -4558,7 +4558,7 @@ cSLOPE.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
return this.value = slope( arr0, arr1 ); return this.value = slope( arr0, arr1 );
...@@ -4881,7 +4881,7 @@ cSTDEVA.prototype.getInfo = function () { ...@@ -4881,7 +4881,7 @@ cSTDEVA.prototype.getInfo = function () {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cSTDEVP() { function cSTDEVP() {
// cBaseFunction.call( this, "STDEVP" ); // cBaseFunction.call( this, "STDEVP" );
...@@ -4900,7 +4900,7 @@ function cSTDEVP() { ...@@ -4900,7 +4900,7 @@ function cSTDEVP() {
} }
cSTDEVP.prototype = Object.create( cBaseFunction.prototype ) cSTDEVP.prototype = Object.create( cBaseFunction.prototype );
cSTDEVP.prototype.Calculate = function ( arg ) { cSTDEVP.prototype.Calculate = function ( arg ) {
function _var( x ) { function _var( x ) {
...@@ -4910,7 +4910,7 @@ cSTDEVP.prototype.Calculate = function ( arg ) { ...@@ -4910,7 +4910,7 @@ cSTDEVP.prototype.Calculate = function ( arg ) {
if ( x[i] instanceof cNumber ) { if ( x[i] instanceof cNumber ) {
_x += x[i].getValue(); _x += x[i].getValue();
tA.push( x[i].getValue() ) tA.push( x[i].getValue() );
xLength++; xLength++;
} }
else if ( x[i] instanceof cError ) { else if ( x[i] instanceof cError ) {
...@@ -4933,46 +4933,46 @@ cSTDEVP.prototype.Calculate = function ( arg ) { ...@@ -4933,46 +4933,46 @@ cSTDEVP.prototype.Calculate = function ( arg ) {
var arr0 = []; var arr0 = [];
for ( var j = 0; j < this.getArguments(); j++ ) { for ( var j = 0; j < arg.length; j++ ) {
var _arg = arg[j];
if ( arg[j] instanceof cArea || arg[j] instanceof cArea3D ) { if ( _arg instanceof cArea || _arg instanceof cArea3D ) {
arg[j].foreach2( function ( elem ) { _arg.foreach2( function ( elem ) {
if ( elem instanceof cNumber || elem instanceof cError ) { if ( elem instanceof cNumber || elem instanceof cError ) {
arr0.push( elem ); arr0.push( elem );
} }
} ); } );
} }
else if ( arg[j] instanceof cRef || arg[j] instanceof cRef3D ) { else if ( _arg instanceof cRef || _arg instanceof cRef3D ) {
var a = arg[j].getValue(); var a = _arg.getValue();
if ( a instanceof cNumber || a instanceof cError ) { if ( a instanceof cNumber || a instanceof cError ) {
arr0.push( a ); arr0.push( a );
} }
} }
else if ( arg[j] instanceof cArray ) { else if ( _arg instanceof cArray ) {
arg[j].foreach( function ( elem ) { _arg.foreach( function ( elem ) {
if ( elem instanceof cNumber || elem instanceof cError ) { if ( elem instanceof cNumber || elem instanceof cError ) {
arr0.push( elem ); arr0.push( elem );
} }
} ); } );
} }
else if ( arg[j] instanceof cNumber || arg[j] instanceof cBool ) { else if ( _arg instanceof cNumber || _arg instanceof cBool ) {
arr0.push( arg[j].tocNumber() ); arr0.push( _arg.tocNumber() );
} }
else if ( arg[j] instanceof cString || arg[j] instanceof cEmpty ) { else if ( _arg instanceof cString || _arg instanceof cEmpty ) {
arr0.push( new cNumber( 0 ) ); arr0.push( new cNumber( 0 ) );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
} }
return this.value = _var( arr0 ); return this.value = _var( arr0 );
} };
cSTDEVP.prototype.getInfo = function () { cSTDEVP.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cSTDEVPA() { function cSTDEVPA() {
// cBaseFunction.call( this, "STDEVPA" ); // cBaseFunction.call( this, "STDEVPA" );
...@@ -5071,17 +5071,17 @@ cSTDEVPA.prototype.Calculate = function ( arg ) { ...@@ -5071,17 +5071,17 @@ cSTDEVPA.prototype.Calculate = function ( arg ) {
arr0.push( new cNumber( 0 ) ); arr0.push( new cNumber( 0 ) );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
} }
return this.value = _var( arr0 ); return this.value = _var( arr0 );
} };
cSTDEVPA.prototype.getInfo = function () { cSTDEVPA.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cSTEYX() { function cSTEYX() {
// cBaseFunction.call( this, "STEYX" ); // cBaseFunction.call( this, "STEYX" );
...@@ -5154,7 +5154,7 @@ cSTEYX.prototype.Calculate = function ( arg ) { ...@@ -5154,7 +5154,7 @@ cSTEYX.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
if ( arg1 instanceof cArea ) { if ( arg1 instanceof cArea ) {
arr1 = arg1.getValue(); arr1 = arg1.getValue();
...@@ -5165,17 +5165,17 @@ cSTEYX.prototype.Calculate = function ( arg ) { ...@@ -5165,17 +5165,17 @@ cSTEYX.prototype.Calculate = function ( arg ) {
} ); } );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
return this.value = steyx( arr0, arr1 ); return this.value = steyx( arr0, arr1 );
} };
cSTEYX.prototype.getInfo = function () { cSTEYX.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( known-ys , known-xs )" args:"( known-ys , known-xs )"
}; };
} };
function cTDIST() { function cTDIST() {
cBaseFunction.call( this, "TDIST" ); cBaseFunction.call( this, "TDIST" );
...@@ -5226,7 +5226,7 @@ function cVAR() { ...@@ -5226,7 +5226,7 @@ function cVAR() {
} }
cVAR.prototype = Object.create( cBaseFunction.prototype ) cVAR.prototype = Object.create( cBaseFunction.prototype );
cVAR.prototype.Calculate = function ( arg ) { cVAR.prototype.Calculate = function ( arg ) {
function _var( x ) { function _var( x ) {
...@@ -5240,7 +5240,7 @@ cVAR.prototype.Calculate = function ( arg ) { ...@@ -5240,7 +5240,7 @@ cVAR.prototype.Calculate = function ( arg ) {
if ( x[i] instanceof cNumber ) { if ( x[i] instanceof cNumber ) {
_x += x[i].getValue(); _x += x[i].getValue();
tA.push( x[i].getValue() ) tA.push( x[i].getValue() );
xLength++; xLength++;
} }
else if ( x[i] instanceof cError ) { else if ( x[i] instanceof cError ) {
...@@ -5263,36 +5263,36 @@ cVAR.prototype.Calculate = function ( arg ) { ...@@ -5263,36 +5263,36 @@ cVAR.prototype.Calculate = function ( arg ) {
var arr0 = []; var arr0 = [];
for ( var j = 0; j < this.getArguments(); j++ ) { for ( var j = 0; j < arg.length; j++ ) {
var _arg = arg[j];
if ( arg[j] instanceof cArea || arg[j] instanceof cArea3D ) { if ( _arg instanceof cArea || _arg instanceof cArea3D ) {
arg[j].foreach2( function ( elem ) { _arg.foreach2( function ( elem ) {
if ( elem instanceof cNumber || elem instanceof cError ){ if ( elem instanceof cNumber || elem instanceof cError ){
arr0.push( elem ); arr0.push( elem );
} }
} ); } );
} }
else if ( arg[j] instanceof cRef || arg[j] instanceof cRef3D ) { else if ( _arg instanceof cRef || _arg instanceof cRef3D ) {
var a = arg[j].getValue(); var a = _arg.getValue();
if ( a instanceof cNumber || a instanceof cError ){ if ( a instanceof cNumber || a instanceof cError ){
arr0.push( a ); arr0.push( a );
} }
} }
else if ( arg[j] instanceof cArray ) { else if ( _arg instanceof cArray ) {
arg[j].foreach( function ( elem ) { _arg.foreach( function ( elem ) {
if ( elem instanceof cNumber || elem instanceof cError ){ if ( elem instanceof cNumber || elem instanceof cError ){
arr0.push( elem ); arr0.push( elem );
} }
} ); } );
} }
else if ( arg[j] instanceof cNumber || arg[j] instanceof cBool ) { else if ( _arg instanceof cNumber || _arg instanceof cBool ) {
arr0.push( arg[j].tocNumber() ); arr0.push( _arg.tocNumber() );
} }
else if ( arg[j] instanceof cString || arg[j] instanceof cEmpty ) { else if ( _arg instanceof cString || _arg instanceof cEmpty ) {
continue; continue;
} }
else{ else{
return this.value = cError( cErrorType.wrong_value_type ); return this.value = new cError( cErrorType.wrong_value_type );
} }
} }
...@@ -5407,7 +5407,7 @@ cVARA.prototype.Calculate = function ( arg ) { ...@@ -5407,7 +5407,7 @@ cVARA.prototype.Calculate = function ( arg ) {
arr0.push( new cNumber( 0 ) ); arr0.push( new cNumber( 0 ) );
} }
else if ( arg[j] instanceof cError ){ else if ( arg[j] instanceof cError ){
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
} }
} }
...@@ -5437,7 +5437,7 @@ function cVARP() { ...@@ -5437,7 +5437,7 @@ function cVARP() {
} }
cVARP.prototype = Object.create( cBaseFunction.prototype ) cVARP.prototype = Object.create( cBaseFunction.prototype );
cVARP.prototype.Calculate = function ( arg ) { cVARP.prototype.Calculate = function ( arg ) {
function _var( x ) { function _var( x ) {
...@@ -5474,36 +5474,36 @@ cVARP.prototype.Calculate = function ( arg ) { ...@@ -5474,36 +5474,36 @@ cVARP.prototype.Calculate = function ( arg ) {
var arr0 = []; var arr0 = [];
for ( var j = 0; j < this.getArguments(); j++ ) { for ( var j = 0; j < arg.length; j++ ) {
var _arg = arg[j];
if ( arg[j] instanceof cArea || arg[j] instanceof cArea3D ) { if ( _arg instanceof cArea || _arg instanceof cArea3D ) {
arg[j].foreach2( function ( elem ) { _arg.foreach2( function ( elem ) {
if ( elem instanceof cNumber || elem instanceof cError ) { if ( elem instanceof cNumber || elem instanceof cError ) {
arr0.push( elem ); arr0.push( elem );
} }
} ); } );
} }
else if ( arg[j] instanceof cRef || arg[j] instanceof cRef3D ) { else if ( _arg instanceof cRef || _arg instanceof cRef3D ) {
var a = arg[j].getValue(); var a = _arg.getValue();
if ( a instanceof cNumber || a instanceof cError ) { if ( a instanceof cNumber || a instanceof cError ) {
arr0.push( a ); arr0.push( a );
} }
} }
else if ( arg[j] instanceof cArray ) { else if ( _arg instanceof cArray ) {
arg[j].foreach( function ( elem ) { _arg.foreach( function ( elem ) {
if ( elem instanceof cNumber || elem instanceof cError ) { if ( elem instanceof cNumber || elem instanceof cError ) {
arr0.push( elem ); arr0.push( elem );
} }
} ); } );
} }
else if ( arg[j] instanceof cNumber || arg[j] instanceof cBool ) { else if ( _arg instanceof cNumber || _arg instanceof cBool ) {
arr0.push( arg[j].tocNumber() ); arr0.push( _arg.tocNumber() );
} }
else if ( arg[j] instanceof cString || arg[j] instanceof cEmpty ) { else if ( _arg instanceof cString || _arg instanceof cEmpty ) {
arr0.push( new cNumber( 0 ) ); arr0.push( new cNumber( 0 ) );
} }
else else
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
} }
return this.value = _var( arr0 ); return this.value = _var( arr0 );
...@@ -5642,7 +5642,7 @@ cVARPA.prototype.Calculate = function ( arg ) { ...@@ -5642,7 +5642,7 @@ cVARPA.prototype.Calculate = function ( arg ) {
arr0.push( new cNumber( 0 ) ); arr0.push( new cNumber( 0 ) );
} }
else if ( elem instanceof cError ){ else if ( elem instanceof cError ){
return this.value = cError( cErrorType.wrong_value_type ) return this.value = new cError( cErrorType.wrong_value_type );
} }
} }
......
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