Commit d8ab4f64 authored by GoshaZotov's avatar GoshaZotov

add IMCOT formula

parent 113736e2
......@@ -52,7 +52,7 @@
cFormulaFunctionGroup['DateAndTime'].push(cDAYS, cISOWEEKNUM);
cFormulaFunctionGroup['Engineering'] = cFormulaFunctionGroup['Engineering'] || [];
cFormulaFunctionGroup['Engineering'].push(cBITAND, cBITLSHIFT, cBITOR, cBITRSHIFT, cBITXOR, cERF_PRECISE,
cERFC_PRECISE, cIMCOT, cIMCSC, cIMCSCH, cIMSEC, cIMSECH, cIMSINH, cIMTAN);
cERFC_PRECISE, cIMCSC, cIMCSCH, cIMSEC, cIMSECH, cIMSINH, cIMTAN);
cFormulaFunctionGroup['TextAndData'] = cFormulaFunctionGroup['TextAndData'] || [];
cFormulaFunctionGroup['TextAndData'].push(cDBCS, cNUMBERVALUE, cUNICHAR, cUNICODE);
cFormulaFunctionGroup['Statistical'] = cFormulaFunctionGroup['Statistical'] || [];
......@@ -616,18 +616,6 @@
cIFNA.prototype = Object.create(cBaseFunction.prototype);
cIFNA.prototype.constructor = cIFNA;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cIMCOT() {
cBaseFunction.call(this, "IMCOT");
this.isXLFN = true;
}
cIMCOT.prototype = Object.create(cBaseFunction.prototype);
cIMCOT.prototype.constructor = cIMCOT;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......
......@@ -476,6 +476,14 @@
} else {
this.real = Math.cos(this.real);
}
}, Cot: function () {
if (this.img) {
var a = Math.sin(2 * this.real) / (Math.cosh(2 * this.img) - Math.cos(2 * this.real));
this.img = -(Math.sinh(2 * this.img) / (Math.cosh(2 * this.img) - Math.cos(2 * this.real)));
this.real = a;
} else {
this.real = 1 / Math.tan(this.real);
}
}, Cosh: function () {
if (this.img) {
var a = Math.cosh(this.real) * Math.cos(this.img);
......@@ -881,7 +889,7 @@
cFormulaFunctionGroup['Engineering'] = cFormulaFunctionGroup['Engineering'] || [];
cFormulaFunctionGroup['Engineering'].push(cBESSELI, cBESSELJ, cBESSELK, cBESSELY, cBIN2DEC, cBIN2HEX, cBIN2OCT,
cCOMPLEX, cCONVERT, cDEC2BIN, cDEC2HEX, cDEC2OCT, cDELTA, cERF, cERFC, cGESTEP, cHEX2BIN, cHEX2DEC, cHEX2OCT,
cIMABS, cIMAGINARY, cIMARGUMENT, cIMCONJUGATE, cIMCOS, cIMCOSH, cIMDIV, cIMEXP, cIMLN, cIMLOG10, cIMLOG2, cIMPOWER,
cIMABS, cIMAGINARY, cIMARGUMENT, cIMCONJUGATE, cIMCOS, cIMCOSH, cIMCOT, cIMDIV, cIMEXP, cIMLN, cIMLOG10, cIMLOG2, cIMPOWER,
cIMPRODUCT, cIMREAL, cIMSIN, cIMSQRT, cIMSUB, cIMSUM, cOCT2BIN, cOCT2DEC, cOCT2HEX);
/**
......@@ -2117,6 +2125,61 @@
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cIMCOT() {
cBaseFunction.call(this, "IMCOT");
}
cIMCOT.prototype = Object.create(cBaseFunction.prototype);
cIMCOT.prototype.constructor = cIMCOT;
cIMCOT.prototype.argumentsMin = 1;
cIMCOT.prototype.argumentsMax = 1;
cIMCOT.prototype.isXLFN = true;
cIMCOT.prototype.Calculate = function (arg) {
var arg0 = arg[0];
if (arg0 instanceof cArea || arg0 instanceof cArea3D) {
arg0 = arg0.cross(arguments[1]);
} else if (arg0 instanceof cArray) {
arg0 = arg0.getElementRowCol(0, 0);
}
if(arg0.value === true || arg0.value === false){
return this.value = new cError(cErrorType.wrong_value_type);
}
arg0 = arg0.tocString();
if (arg0 instanceof cError) {
return this.value = arg0;
}
if(0 == arg0.value){
return this.value = new cError(cErrorType.not_numeric);
}
var c = new Complex(arg0.toString());
if (c instanceof cError) {
return this.value = c;
}
c.Cot();
this.value = new cString(c.toString());
this.value.numFormat = 0;
return this.value;
};
cIMCOT.prototype.getInfo = function () {
return {
name: this.name, args: "( complex-number )"
};
};
/**
* @constructor
* @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