Commit bae8264c authored by GoshaZotov's avatar GoshaZotov

add BITOR formula

parent 93a38219
...@@ -7680,6 +7680,14 @@ $( function () { ...@@ -7680,6 +7680,14 @@ $( function () {
}); });
test( "Test: \"BITOR\"", function () {
oParser = new parserFormula( 'BITOR(23,10)', "AA2", ws );
ok( oParser.parse());
strictEqual( oParser.calculate().getValue(), 31 );
});
function putDataForDatabase(){ function putDataForDatabase(){
ws.getRange2( "A1" ).setValue( "Tree" ); ws.getRange2( "A1" ).setValue( "Tree" );
ws.getRange2( "A2" ).setValue( "Apple" ); ws.getRange2( "A2" ).setValue( "Apple" );
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
cFormulaFunctionGroup['DateAndTime'] = cFormulaFunctionGroup['DateAndTime'] || []; cFormulaFunctionGroup['DateAndTime'] = cFormulaFunctionGroup['DateAndTime'] || [];
cFormulaFunctionGroup['DateAndTime'].push(cDAYS, cISOWEEKNUM); cFormulaFunctionGroup['DateAndTime'].push(cDAYS, cISOWEEKNUM);
cFormulaFunctionGroup['Engineering'] = cFormulaFunctionGroup['Engineering'] || []; cFormulaFunctionGroup['Engineering'] = cFormulaFunctionGroup['Engineering'] || [];
cFormulaFunctionGroup['Engineering'].push(cBITLSHIFT, cBITOR, cBITRSHIFT, cBITXOR); cFormulaFunctionGroup['Engineering'].push(cBITLSHIFT, cBITRSHIFT, cBITXOR);
cFormulaFunctionGroup['TextAndData'] = cFormulaFunctionGroup['TextAndData'] || []; cFormulaFunctionGroup['TextAndData'] = cFormulaFunctionGroup['TextAndData'] || [];
cFormulaFunctionGroup['TextAndData'].push(cDBCS, cUNICHAR, cUNICODE); cFormulaFunctionGroup['TextAndData'].push(cDBCS, cUNICHAR, cUNICODE);
cFormulaFunctionGroup['Statistical'] = cFormulaFunctionGroup['Statistical'] || []; cFormulaFunctionGroup['Statistical'] = cFormulaFunctionGroup['Statistical'] || [];
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
cFormulaFunctionGroup['Information'].push(cSHEET, cSHEETS); cFormulaFunctionGroup['Information'].push(cSHEET, cSHEETS);
cFormulaFunctionGroup['NotRealised'] = cFormulaFunctionGroup['NotRealised'] || []; cFormulaFunctionGroup['NotRealised'] = cFormulaFunctionGroup['NotRealised'] || [];
cFormulaFunctionGroup['NotRealised'].push(cDAYS, cISOWEEKNUM, cBITLSHIFT, cBITOR, cBITRSHIFT, cBITXOR, cFormulaFunctionGroup['NotRealised'].push(cDAYS, cISOWEEKNUM, cBITLSHIFT, cBITRSHIFT, cBITXOR,
cDBCS, cUNICHAR, cUNICODE, cBINOM_DIST_RANGE, cF_TEST, cFORECAST_ETS, cFORECAST_ETS_CONFINT, cDBCS, cUNICHAR, cUNICODE, cBINOM_DIST_RANGE, cF_TEST, cFORECAST_ETS, cFORECAST_ETS_CONFINT,
cFORECAST_ETS_SEASONALITY, cFORECAST_ETS_STAT, cHYPGEOM_DIST, cPDURATION, cFORECAST_ETS_SEASONALITY, cFORECAST_ETS_STAT, cHYPGEOM_DIST, cPDURATION,
cAGGREGATE, cMUNIT, cFORMULATEXT, cSHEET, cSHEETS); cAGGREGATE, cMUNIT, cFORMULATEXT, cSHEET, cSHEETS);
...@@ -108,18 +108,6 @@ ...@@ -108,18 +108,6 @@
cBITLSHIFT.prototype = Object.create(cBaseFunction.prototype); cBITLSHIFT.prototype = Object.create(cBaseFunction.prototype);
cBITLSHIFT.prototype.constructor = cBITLSHIFT; cBITLSHIFT.prototype.constructor = cBITLSHIFT;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cBITOR() {
cBaseFunction.call(this, "BITOR");
this.isXLFN = true;
}
cBITOR.prototype = Object.create(cBaseFunction.prototype);
cBITOR.prototype.constructor = cBITOR;
/** /**
* @constructor * @constructor
* @extends {AscCommonExcel.cBaseFunction} * @extends {AscCommonExcel.cBaseFunction}
......
...@@ -935,11 +935,11 @@ ...@@ -935,11 +935,11 @@
}; };
cFormulaFunctionGroup['Engineering'] = cFormulaFunctionGroup['Engineering'] || []; cFormulaFunctionGroup['Engineering'] = cFormulaFunctionGroup['Engineering'] || [];
cFormulaFunctionGroup['Engineering'].push(cBESSELI, cBESSELJ, cBESSELK, cBESSELY, cBIN2DEC, cBIN2HEX, cBIN2OCT, cBITAND, cFormulaFunctionGroup['Engineering'].push(cBESSELI, cBESSELJ, cBESSELK, cBESSELY, cBIN2DEC, cBIN2HEX, cBIN2OCT,
cCOMPLEX, cCONVERT, cDEC2BIN, cDEC2HEX, cDEC2OCT, cDELTA, cERF, cERF_PRECISE, cERFC, cERFC_PRECISE, cGESTEP, cHEX2BIN, cBITAND, cBITOR, cCOMPLEX, cCONVERT, cDEC2BIN, cDEC2HEX, cDEC2OCT, cDELTA, cERF, cERF_PRECISE, cERFC,
cHEX2DEC, cHEX2OCT, cIMABS, cIMAGINARY, cIMARGUMENT, cIMCONJUGATE, cIMCOS, cIMCOSH, cIMCOT, cIMCSC, cIMCSCH, cERFC_PRECISE, cGESTEP, cHEX2BIN, cHEX2DEC, cHEX2OCT, cIMABS, cIMAGINARY, cIMARGUMENT, cIMCONJUGATE, cIMCOS,
cIMDIV, cIMEXP, cIMLN, cIMLOG10, cIMLOG2, cIMPOWER, cIMPRODUCT, cIMREAL, cIMSEC, cIMSECH, cIMSIN, cIMSINH, cIMCOSH, cIMCOT, cIMCSC, cIMCSCH, cIMDIV, cIMEXP, cIMLN, cIMLOG10, cIMLOG2, cIMPOWER, cIMPRODUCT, cIMREAL,
cIMSQRT, cIMSUB, cIMSUM, cIMTAN, cOCT2BIN, cOCT2DEC, cOCT2HEX); cIMSEC, cIMSECH, cIMSIN, cIMSINH, cIMSQRT, cIMSUB, cIMSUM, cIMTAN, cOCT2BIN, cOCT2DEC, cOCT2HEX);
cFormulaFunctionGroup['NotRealised'] = cFormulaFunctionGroup['NotRealised'] || []; cFormulaFunctionGroup['NotRealised'] = cFormulaFunctionGroup['NotRealised'] || [];
cFormulaFunctionGroup['NotRealised'].push(cBESSELI, cBESSELJ, cBESSELK, cBESSELY, cCONVERT); cFormulaFunctionGroup['NotRealised'].push(cBESSELI, cBESSELJ, cBESSELK, cBESSELY, cCONVERT);
...@@ -1250,6 +1250,46 @@ ...@@ -1250,6 +1250,46 @@
return this.value = this._findArrayInNumberArguments(oArguments, calcFunc); return this.value = this._findArrayInNumberArguments(oArguments, calcFunc);
}; };
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cBITOR() {
cBaseFunction.call(this, "BITOR");
}
cBITOR.prototype = Object.create(cBaseFunction.prototype);
cBITOR.prototype.constructor = cBITOR;
cBITOR.prototype.argumentsMin = 2;
cBITOR.prototype.argumentsMax = 2;
cBITOR.prototype.isXLFN = true;
cBITOR.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();
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
var calcFunc = function(argArray){
var arg0 = Math.floor(argArray[0]);
var arg1 = Math.floor(argArray[1]);
if ( arg0 < 0 || arg1 < 0 /*|| arg0 > 2^48 || arg1 > 2^48*/){
return new cError(cErrorType.not_numeric);
}
var res = arg0 | arg1;
return null !== res && !isNaN(res) ? new cNumber(res) : new cError(cErrorType.wrong_value_type);
};
return this.value = this._findArrayInNumberArguments(oArguments, calcFunc);
};
/** /**
* @constructor * @constructor
* @extends {AscCommonExcel.cBaseFunction} * @extends {AscCommonExcel.cBaseFunction}
......
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