Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat(formula): supplement IMCOTH/IMLOG/IMTANH formula (#3909)
wpxp12345677e7c678ea80
diff --git a/packages/engine-formula/src/basics/complex.ts b/packages/engine-formula/src/basics/complex.tsindex 827d277e09..09fc9d79a8 100644--- a/packages/engine-formula/src/basics/complex.ts+++ b/packages/engine-formula/src/basics/complex.ts@@ -310,6 +310,25 @@ export class Complex {}}+ Coth(): number | string {+ if (!Number.isFinite(Math.sinh(this._realNum)) || !Number.isFinite(Math.cosh(this._realNum))) {+ this._isError = true;+ return '';+ }++ if (this._iNum) {+ const den = Decimal.cosh(this._realNum * 2).sub(Decimal.cos(this._iNum * 2));+ const realNum = Decimal.sinh(this._realNum * 2).div(den).toNumber();+ const iNum = Decimal.sin(this._iNum * 2).div(den).negated().toNumber();++ return Complex.getComplex(realNum, iNum, this._suffix);+ } else {+ const realNum = new Decimal(1).div(Decimal.tanh(this._realNum)).toNumber();++ return Complex.getComplex(realNum, this._iNum, this._suffix);+ }+ }+Csc(): number | string {if (this._iNum) {const den = Decimal.cosh(this._iNum * 2).sub(Decimal.cos(this._realNum * 2));@@ -377,7 +396,7 @@ export class Complex {return Complex.getComplex(realNum, iNum, this._suffix);}- Log10(): number | string {+ Log(base: number): number | string {const abs = Decimal.sqrt(Decimal.pow(this._realNum, 2).add(Decimal.pow(this._iNum, 2)));const Decimal_realNum1 = Decimal.ln(abs);let Decimal_iNum1 = Decimal.acos(new Decimal(this._realNum).div(abs));@@ -386,29 +405,16 @@ export class Complex {Decimal_iNum1 = Decimal_iNum1.negated();}- const Decimal_realNum2 = Decimal.ln(10);+ const Decimal_realNum2 = Decimal.ln(base);const Decimal_iNum2 = new Decimal(0);const den = Decimal_realNum2.mul(Decimal_realNum2).add(Decimal_iNum2.mul(Decimal_iNum2));- const realNum = Decimal_realNum1.mul(Decimal_realNum2).add(Decimal_iNum1.mul(Decimal_iNum2)).div(den).toNumber();- const iNum = Decimal_iNum1.mul(Decimal_realNum2).sub(Decimal_realNum1.mul(Decimal_iNum2)).div(den).toNumber();-- return Complex.getComplex(realNum, iNum, this._suffix);- }-- Log2(): number | string {- const abs = Decimal.sqrt(Decimal.pow(this._realNum, 2).add(Decimal.pow(this._iNum, 2)));- const Decimal_realNum1 = Decimal.ln(abs);- let Decimal_iNum1 = Decimal.acos(new Decimal(this._realNum).div(abs));- if (this._iNum < 0) {- Decimal_iNum1 = Decimal_iNum1.negated();+ if (den.eq(0)) {+ this._isError = true;+ return '';}- const Decimal_realNum2 = Decimal.ln(2);- const Decimal_iNum2 = new Decimal(0);-- const den = Decimal_realNum2.mul(Decimal_realNum2).add(Decimal_iNum2.mul(Decimal_iNum2));const realNum = Decimal_realNum1.mul(Decimal_realNum2).add(Decimal_iNum1.mul(Decimal_iNum2)).div(den).toNumber();const iNum = Decimal_iNum1.mul(Decimal_realNum2).sub(Decimal_realNum1.mul(Decimal_iNum2)).div(den).toNumber();@@ -580,4 +586,23 @@ export class Complex {return Complex.getComplex(realNum, this._iNum, this._suffix);}}++ Tanh(): number | string {+ if (!Number.isFinite(Math.sinh(this._realNum)) || !Number.isFinite(Math.cosh(this._realNum))) {+ this._isError = true;+ return '';+ }++ if (this._iNum) {+ const den = Decimal.cosh(this._realNum * 2).add(Decimal.cos(this._iNum * 2));+ const realNum = Decimal.sinh(this._realNum * 2).div(den).toNumber();+ const iNum = Decimal.sin(this._iNum * 2).div(den).toNumber();++ return Complex.getComplex(realNum, iNum, this._suffix);+ } else {+ const realNum = Decimal.tanh(this._realNum).toNumber();++ return Complex.getComplex(realNum, this._iNum, this._suffix);+ }+ }}diff --git a/packages/engine-formula/src/functions/engineering/function-map.ts b/packages/engine-formula/src/functions/engineering/function-map.tsindex f06aca73e9..7cec49f04e 100644--- a/packages/engine-formula/src/functions/engineering/function-map.ts+++ b/packages/engine-formula/src/functions/engineering/function-map.ts@@ -14,7 +14,6 @@* limitations under the License.*/-import { FUNCTION_NAMES_ENGINEERING } from './function-names';import { Besseli } from './besseli';import { Besselj } from './besselj';import { Besselk } from './besselk';@@ -37,6 +36,7 @@ import { Erf } from './erf';import { ErfPrecise } from './erf-precise';import { Erfc } from './erfc';import { ErfcPrecise } from './erfc-precise';+import { FUNCTION_NAMES_ENGINEERING } from './function-names';import { Gestep } from './gestep';import { Hex2bin } from './hex2bin';import { Hex2dec } from './hex2dec';@@ -48,13 +48,15 @@ import { Imconjugate } from './imconjugate';import { Imcos } from './imcos';import { Imcosh } from './imcosh';import { Imcot } from './imcot';+import { Imcoth } from './imcoth';import { Imcsc } from './imcsc';import { Imcsch } from './imcsch';import { Imdiv } from './imdiv';import { Imexp } from './imexp';import { Imln } from './imln';-import { Imlog10 } from './imlog10';+import { Imlog } from './imlog';import { Imlog2 } from './imlog2';+import { Imlog10 } from './imlog10';import { Impower } from './impower';import { Improduct } from './improduct';import { Imreal } from './imreal';@@ -66,6 +68,7 @@ import { Imsqrt } from './imsqrt';import { Imsub } from './imsub';import { Imsum } from './imsum';import { Imtan } from './imtan';+import { Imtanh } from './imtanh';import { Oct2bin } from './oct2bin';import { Oct2dec } from './oct2dec';import { Oct2hex } from './oct2hex';@@ -104,11 +107,13 @@ export const functionEngineering = [[Imcos, FUNCTION_NAMES_ENGINEERING.IMCOS],[Imcosh, FUNCTION_NAMES_ENGINEERING.IMCOSH],[Imcot, FUNCTION_NAMES_ENGINEERING.IMCOT],+ [Imcoth, FUNCTION_NAMES_ENGINEERING.IMCOTH],[Imcsc, FUNCTION_NAMES_ENGINEERING.IMCSC],[Imcsch, FUNCTION_NAMES_ENGINEERING.IMCSCH],[Imdiv, FUNCTION_NAMES_ENGINEERING.IMDIV],[Imexp, FUNCTION_NAMES_ENGINEERING.IMEXP],[Imln, FUNCTION_NAMES_ENGINEERING.IMLN],+ [Imlog, FUNCTION_NAMES_ENGINEERING.IMLOG],[Imlog10, FUNCTION_NAMES_ENGINEERING.IMLOG10],[Imlog2, FUNCTION_NAMES_ENGINEERING.IMLOG2],[Impower, FUNCTION_NAMES_ENGINEERING.IMPOWER],@@ -122,6 +127,7 @@ export const functionEngineering = [[Imsub, FUNCTION_NAMES_ENGINEERING.IMSUB],[Imsum, FUNCTION_NAMES_ENGINEERING.IMSUM],[Imtan, FUNCTION_NAMES_ENGINEERING.IMTAN],+ [Imtanh, FUNCTION_NAMES_ENGINEERING.IMTANH],[Oct2bin, FUNCTION_NAMES_ENGINEERING.OCT2BIN],[Oct2dec, FUNCTION_NAMES_ENGINEERING.OCT2DEC],[Oct2hex, FUNCTION_NAMES_ENGINEERING.OCT2HEX],diff --git a/packages/engine-formula/src/functions/engineering/function-names.ts b/packages/engine-formula/src/functions/engineering/function-names.tsindex a9ace6ad9e..a92a8c194c 100644--- a/packages/engine-formula/src/functions/engineering/function-names.ts+++ b/packages/engine-formula/src/functions/engineering/function-names.ts@@ -48,11 +48,13 @@ export enum FUNCTION_NAMES_ENGINEERING {IMCOS = 'IMCOS',IMCOSH = 'IMCOSH',IMCOT = 'IMCOT',+ IMCOTH = 'IMCOTH',IMCSC = 'IMCSC',IMCSCH = 'IMCSCH',IMDIV = 'IMDIV',IMEXP = 'IMEXP',IMLN = 'IMLN',+ IMLOG = 'IMLOG',IMLOG10 = 'IMLOG10',IMLOG2 = 'IMLOG2',IMPOWER = 'IMPOWER',@@ -66,6 +68,7 @@ export enum FUNCTION_NAMES_ENGINEERING {IMSUB = 'IMSUB',IMSUM = 'IMSUM',IMTAN = 'IMTAN',+ IMTANH = 'IMTANH',OCT2BIN = 'OCT2BIN',OCT2DEC = 'OCT2DEC',OCT2HEX = 'OCT2HEX',diff --git a/packages/engine-formula/src/functions/engineering/imcoth/__tests__/index.spec.ts b/packages/engine-formula/src/functions/engineering/imcoth/__tests__/index.spec.tsnew file mode 100644index 0000000000..cf7ce508a5--- /dev/null+++ b/packages/engine-formula/src/functions/engineering/imcoth/__tests__/index.spec.ts@@ -0,0 +1,99 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import { describe, expect, it } from 'vitest';++import { ErrorType } from '../../../../basics/error-type';+import { ArrayValueObject, transformToValueObject } from '../../../../engine/value-object/array-value-object';+import { ErrorValueObject } from '../../../../engine/value-object/base-value-object';+import { BooleanValueObject, NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';+import { FUNCTION_NAMES_ENGINEERING } from '../../function-names';+import { Imcoth } from '../index';++describe('Test imcoth function', () => {+ const testFunction = new Imcoth(FUNCTION_NAMES_ENGINEERING.IMCOTH);++ describe('Imcoth', () => {+ it('Value is normal number', () => {+ const inumber = StringValueObject.create('5+12i');+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe('1.00003851275523+0.0000822295549932979i');+ });++ it('Value is large numbers', () => {+ const inumber = NumberValueObject.create(25698432);+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(ErrorType.NUM);+ });++ it('Value is number string', () => {+ const inumber = StringValueObject.create('1.5');+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(1.10479139298251);+ });++ it('Value is normal string', () => {+ const inumber = StringValueObject.create('test');+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(ErrorType.NUM);+ });++ it('Value is boolean', () => {+ const inumber = BooleanValueObject.create(true);+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(ErrorType.VALUE);+ });++ it('Value is blank cell', () => {+ const inumber = ArrayValueObject.create({+ calculateValueList: transformToValueObject([+ [null],+ ]),+ rowCount: 1,+ columnCount: 1,+ unitId: '',+ sheetId: '',+ row: 0,+ column: 0,+ });+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(ErrorType.NUM);+ });++ it('Value is error', () => {+ const inumber = ErrorValueObject.create(ErrorType.NAME);+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(ErrorType.NAME);+ });++ it('Value is array', () => {+ const inumber = ArrayValueObject.create({+ calculateValueList: transformToValueObject([+ [1, ' ', 1.23, true, false, null],+ [0, '100', '2.34', 'test', -3, ErrorType.NAME],+ ]),+ rowCount: 2,+ columnCount: 6,+ unitId: '',+ sheetId: '',+ row: 0,+ column: 0,+ });+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toStrictEqual(ErrorType.VALUE);+ });+ });+});diff --git a/packages/engine-formula/src/functions/engineering/imcoth/index.ts b/packages/engine-formula/src/functions/engineering/imcoth/index.tsnew file mode 100644index 0000000000..89faf0fe09--- /dev/null+++ b/packages/engine-formula/src/functions/engineering/imcoth/index.ts@@ -0,0 +1,64 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import type { BaseValueObject } from '../../../engine/value-object/base-value-object';+import { isRealNum } from '@univerjs/core';+import { Complex } from '../../../basics/complex';+import { ErrorType } from '../../../basics/error-type';+import { checkVariantsErrorIsArrayOrBoolean } from '../../../engine/utils/check-variant-error';+import { ErrorValueObject } from '../../../engine/value-object/base-value-object';+import { NumberValueObject, StringValueObject } from '../../../engine/value-object/primitive-object';+import { BaseFunction } from '../../base-function';++export class Imcoth extends BaseFunction {+ override minParams = 1;++ override maxParams = 1;++ override calculate(inumber: BaseValueObject): BaseValueObject {+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(inumber);++ if (isError) {+ return errorObject as ErrorValueObject;+ }++ const [inumberObject] = variants as BaseValueObject[];++ const inumberValue = `${inumberObject.getValue()}`;++ const complex = new Complex(inumberValue);++ if (complex.isError()) {+ return ErrorValueObject.create(ErrorType.NUM);+ }++ if (complex.getRealNum() === 0 && complex.getINum() === 0) {+ return ErrorValueObject.create(ErrorType.NUM);+ }++ const result = complex.Coth();++ if (complex.isError()) {+ return ErrorValueObject.create(ErrorType.NUM);+ }++ if (typeof result === 'number' || isRealNum(result)) {+ return NumberValueObject.create(+result);+ }++ return StringValueObject.create(result);+ }+}diff --git a/packages/engine-formula/src/functions/engineering/imlog/__tests__/index.spec.ts b/packages/engine-formula/src/functions/engineering/imlog/__tests__/index.spec.tsnew file mode 100644index 0000000000..b94227a2b4--- /dev/null+++ b/packages/engine-formula/src/functions/engineering/imlog/__tests__/index.spec.ts@@ -0,0 +1,146 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import { describe, expect, it } from 'vitest';++import { ErrorType } from '../../../../basics/error-type';+import { ArrayValueObject, transformToValueObject } from '../../../../engine/value-object/array-value-object';+import { ErrorValueObject } from '../../../../engine/value-object/base-value-object';+import { BooleanValueObject, NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';+import { FUNCTION_NAMES_ENGINEERING } from '../../function-names';+import { Imlog } from '../index';++describe('Test imlog function', () => {+ const testFunction = new Imlog(FUNCTION_NAMES_ENGINEERING.IMLOG);++ describe('Imlog', () => {+ it('Value is normal number', () => {+ const inumber = StringValueObject.create('5+12i');+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe('1.11394335230684+0.510732572130908i');++ const inumber2 = StringValueObject.create('5-12i');+ const result2 = testFunction.calculate(inumber2);+ expect(result2.getValue()).toBe('1.11394335230684-0.510732572130908i');+ });++ it('Base value test', () => {+ const inumber = StringValueObject.create('5+12i');+ const base = NumberValueObject.create(0);+ const result = testFunction.calculate(inumber, base);+ expect(result.getValue()).toBe(ErrorType.NUM);++ const base2 = StringValueObject.create('test');+ const result2 = testFunction.calculate(inumber, base2);+ expect(result2.getValue()).toBe(ErrorType.VALUE);++ const base3 = ArrayValueObject.create({+ calculateValueList: transformToValueObject([+ [2],+ ]),+ rowCount: 1,+ columnCount: 1,+ unitId: '',+ sheetId: '',+ row: 0,+ column: 0,+ });+ const result3 = testFunction.calculate(inumber, base3);+ expect(result3.getValue()).toBe('3.70043971814109+1.69661688033575i');++ const base4 = ArrayValueObject.create({+ calculateValueList: transformToValueObject([+ [1, 2],+ ]),+ rowCount: 1,+ columnCount: 2,+ unitId: '',+ sheetId: '',+ row: 0,+ column: 0,+ });+ const result4 = testFunction.calculate(inumber, base4);+ expect(result4.getValue()).toBe(ErrorType.VALUE);++ const base5 = NumberValueObject.create(1);+ const result5 = testFunction.calculate(inumber, base5);+ expect(result5.getValue()).toBe(ErrorType.NUM);+ });++ it('Value is large numbers', () => {+ const inumber = NumberValueObject.create(25698432);+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(7.40990662548997);+ });++ it('Value is number string', () => {+ const inumber = StringValueObject.create('1.5');+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(0.176091259055681);+ });++ it('Value is normal string', () => {+ const inumber = StringValueObject.create('test');+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(ErrorType.NUM);+ });++ it('Value is boolean', () => {+ const inumber = BooleanValueObject.create(true);+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(ErrorType.VALUE);+ });++ it('Value is blank cell', () => {+ const inumber = ArrayValueObject.create({+ calculateValueList: transformToValueObject([+ [null],+ ]),+ rowCount: 1,+ columnCount: 1,+ unitId: '',+ sheetId: '',+ row: 0,+ column: 0,+ });+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(ErrorType.NUM);+ });++ it('Value is error', () => {+ const inumber = ErrorValueObject.create(ErrorType.NAME);+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(ErrorType.NAME);+ });++ it('Value is array', () => {+ const inumber = ArrayValueObject.create({+ calculateValueList: transformToValueObject([+ [1, ' ', 1.23, true, false, null],+ [0, '100', '2.34', 'test', -3, ErrorType.NAME],+ ]),+ rowCount: 2,+ columnCount: 6,+ unitId: '',+ sheetId: '',+ row: 0,+ column: 0,+ });+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toStrictEqual(ErrorType.VALUE);+ });+ });+});diff --git a/packages/engine-formula/src/functions/engineering/imlog/index.ts b/packages/engine-formula/src/functions/engineering/imlog/index.tsnew file mode 100644index 0000000000..ce7676cd7d--- /dev/null+++ b/packages/engine-formula/src/functions/engineering/imlog/index.ts@@ -0,0 +1,91 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import type { ArrayValueObject } from '../../../engine/value-object/array-value-object';+import type { BaseValueObject } from '../../../engine/value-object/base-value-object';+import { isRealNum } from '@univerjs/core';+import { Complex } from '../../../basics/complex';+import { ErrorType } from '../../../basics/error-type';+import { checkVariantsErrorIsArrayOrBoolean, checkVariantsErrorIsStringToNumber } from '../../../engine/utils/check-variant-error';+import { ErrorValueObject } from '../../../engine/value-object/base-value-object';+import { NumberValueObject, StringValueObject } from '../../../engine/value-object/primitive-object';+import { BaseFunction } from '../../base-function';++export class Imlog extends BaseFunction {+ override minParams = 1;++ override maxParams = 2;++ override calculate(inumber: BaseValueObject, base?: BaseValueObject): BaseValueObject {+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(inumber);++ if (isError) {+ return errorObject as ErrorValueObject;+ }++ const [inumberObject] = variants as BaseValueObject[];++ let _base = base ?? NumberValueObject.create(10);++ if (_base.isArray()) {+ const rowCount = (_base as ArrayValueObject).getRowCount();+ const columnCount = (_base as ArrayValueObject).getColumnCount();++ if (rowCount > 1 || columnCount > 1) {+ return ErrorValueObject.create(ErrorType.VALUE);+ }++ _base = (_base as ArrayValueObject).get(0, 0) as BaseValueObject;+ }++ const { isError: _isError, errorObject: _errorObject, variants: _variants } = checkVariantsErrorIsStringToNumber(_base);++ if (_isError) {+ return _errorObject as ErrorValueObject;+ }++ const [baseObject] = _variants as BaseValueObject[];++ const inumberValue = `${inumberObject.getValue()}`;+ const baseValue = +baseObject.getValue();++ const complex = new Complex(inumberValue);++ if (complex.isError()) {+ return ErrorValueObject.create(ErrorType.NUM);+ }++ if (complex.getRealNum() === 0 && complex.getINum() === 0) {+ return ErrorValueObject.create(ErrorType.NUM);+ }++ if (baseValue <= 0) {+ return ErrorValueObject.create(ErrorType.NUM);+ }++ const result = complex.Log(baseValue);++ if (complex.isError()) {+ return ErrorValueObject.create(ErrorType.NUM);+ }++ if (typeof result === 'number' || isRealNum(result)) {+ return NumberValueObject.create(+result);+ }++ return StringValueObject.create(result);+ }+}diff --git a/packages/engine-formula/src/functions/engineering/imlog10/__tests__/index.spec.ts b/packages/engine-formula/src/functions/engineering/imlog10/__tests__/index.spec.tsindex 8e274bf15e..01178b9948 100644--- a/packages/engine-formula/src/functions/engineering/imlog10/__tests__/index.spec.ts+++ b/packages/engine-formula/src/functions/engineering/imlog10/__tests__/index.spec.ts@@ -16,12 +16,12 @@import { describe, expect, it } from 'vitest';-import { FUNCTION_NAMES_ENGINEERING } from '../../function-names';-import { Imlog10 } from '../index';-import { BooleanValueObject, NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';-import { ArrayValueObject, transformToValueObject } from '../../../../engine/value-object/array-value-object';import { ErrorType } from '../../../../basics/error-type';+import { ArrayValueObject, transformToValueObject } from '../../../../engine/value-object/array-value-object';import { ErrorValueObject } from '../../../../engine/value-object/base-value-object';+import { BooleanValueObject, NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';+import { FUNCTION_NAMES_ENGINEERING } from '../../function-names';+import { Imlog10 } from '../index';describe('Test imlog10 function', () => {const testFunction = new Imlog10(FUNCTION_NAMES_ENGINEERING.IMLOG10);diff --git a/packages/engine-formula/src/functions/engineering/imlog10/index.ts b/packages/engine-formula/src/functions/engineering/imlog10/index.tsindex 4a93ac1d4a..038658c0be 100644--- a/packages/engine-formula/src/functions/engineering/imlog10/index.ts+++ b/packages/engine-formula/src/functions/engineering/imlog10/index.ts@@ -14,14 +14,14 @@* limitations under the License.*/-import { isRealNum } from '@univerjs/core';import type { BaseValueObject } from '../../../engine/value-object/base-value-object';-import { ErrorValueObject } from '../../../engine/value-object/base-value-object';-import { BaseFunction } from '../../base-function';-import { NumberValueObject, StringValueObject } from '../../../engine/value-object/primitive-object';-import { checkVariantsErrorIsArrayOrBoolean } from '../../../engine/utils/check-variant-error';+import { isRealNum } from '@univerjs/core';import { Complex } from '../../../basics/complex';import { ErrorType } from '../../../basics/error-type';+import { checkVariantsErrorIsArrayOrBoolean } from '../../../engine/utils/check-variant-error';+import { ErrorValueObject } from '../../../engine/value-object/base-value-object';+import { NumberValueObject, StringValueObject } from '../../../engine/value-object/primitive-object';+import { BaseFunction } from '../../base-function';export class Imlog10 extends BaseFunction {override minParams = 1;@@ -49,7 +49,7 @@ export class Imlog10 extends BaseFunction {return ErrorValueObject.create(ErrorType.NUM);}- const result = complex.Log10();+ const result = complex.Log(10);if (typeof result === 'number' || isRealNum(result)) {return NumberValueObject.create(+result);diff --git a/packages/engine-formula/src/functions/engineering/imlog2/__tests__/index.spec.ts b/packages/engine-formula/src/functions/engineering/imlog2/__tests__/index.spec.tsindex 43631fcaf0..82e74ac875 100644--- a/packages/engine-formula/src/functions/engineering/imlog2/__tests__/index.spec.ts+++ b/packages/engine-formula/src/functions/engineering/imlog2/__tests__/index.spec.ts@@ -16,12 +16,12 @@import { describe, expect, it } from 'vitest';-import { FUNCTION_NAMES_ENGINEERING } from '../../function-names';-import { Imlog2 } from '../index';-import { BooleanValueObject, NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';-import { ArrayValueObject, transformToValueObject } from '../../../../engine/value-object/array-value-object';import { ErrorType } from '../../../../basics/error-type';+import { ArrayValueObject, transformToValueObject } from '../../../../engine/value-object/array-value-object';import { ErrorValueObject } from '../../../../engine/value-object/base-value-object';+import { BooleanValueObject, NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';+import { FUNCTION_NAMES_ENGINEERING } from '../../function-names';+import { Imlog2 } from '../index';describe('Test imlog2 function', () => {const testFunction = new Imlog2(FUNCTION_NAMES_ENGINEERING.IMLOG2);diff --git a/packages/engine-formula/src/functions/engineering/imlog2/index.ts b/packages/engine-formula/src/functions/engineering/imlog2/index.tsindex 2fd47f2dbd..8880870094 100644--- a/packages/engine-formula/src/functions/engineering/imlog2/index.ts+++ b/packages/engine-formula/src/functions/engineering/imlog2/index.ts@@ -14,14 +14,14 @@* limitations under the License.*/-import { isRealNum } from '@univerjs/core';import type { BaseValueObject } from '../../../engine/value-object/base-value-object';-import { ErrorValueObject } from '../../../engine/value-object/base-value-object';-import { BaseFunction } from '../../base-function';-import { NumberValueObject, StringValueObject } from '../../../engine/value-object/primitive-object';-import { checkVariantsErrorIsArrayOrBoolean } from '../../../engine/utils/check-variant-error';+import { isRealNum } from '@univerjs/core';import { Complex } from '../../../basics/complex';import { ErrorType } from '../../../basics/error-type';+import { checkVariantsErrorIsArrayOrBoolean } from '../../../engine/utils/check-variant-error';+import { ErrorValueObject } from '../../../engine/value-object/base-value-object';+import { NumberValueObject, StringValueObject } from '../../../engine/value-object/primitive-object';+import { BaseFunction } from '../../base-function';export class Imlog2 extends BaseFunction {override minParams = 1;@@ -49,7 +49,7 @@ export class Imlog2 extends BaseFunction {return ErrorValueObject.create(ErrorType.NUM);}- const result = complex.Log2();+ const result = complex.Log(2);if (typeof result === 'number' || isRealNum(result)) {return NumberValueObject.create(+result);diff --git a/packages/engine-formula/src/functions/engineering/imtanh/__tests__/index.spec.ts b/packages/engine-formula/src/functions/engineering/imtanh/__tests__/index.spec.tsnew file mode 100644index 0000000000..6b8a80ecc7--- /dev/null+++ b/packages/engine-formula/src/functions/engineering/imtanh/__tests__/index.spec.ts@@ -0,0 +1,99 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import { describe, expect, it } from 'vitest';++import { ErrorType } from '../../../../basics/error-type';+import { ArrayValueObject, transformToValueObject } from '../../../../engine/value-object/array-value-object';+import { ErrorValueObject } from '../../../../engine/value-object/base-value-object';+import { BooleanValueObject, NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';+import { FUNCTION_NAMES_ENGINEERING } from '../../function-names';+import { Imtanh } from '../index';++describe('Test imtanh function', () => {+ const testFunction = new Imtanh(FUNCTION_NAMES_ENGINEERING.IMTANH);++ describe('Imtanh', () => {+ it('Value is normal number', () => {+ const inumber = StringValueObject.create('5+12i');+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe('0.99996148196703-0.000082223221029802i');+ });++ it('Value is large numbers', () => {+ const inumber = NumberValueObject.create(25698432);+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(ErrorType.NUM);+ });++ it('Value is number string', () => {+ const inumber = StringValueObject.create('1.5');+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(0.905148253644866);+ });++ it('Value is normal string', () => {+ const inumber = StringValueObject.create('test');+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(ErrorType.NUM);+ });++ it('Value is boolean', () => {+ const inumber = BooleanValueObject.create(true);+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(ErrorType.VALUE);+ });++ it('Value is blank cell', () => {+ const inumber = ArrayValueObject.create({+ calculateValueList: transformToValueObject([+ [null],+ ]),+ rowCount: 1,+ columnCount: 1,+ unitId: '',+ sheetId: '',+ row: 0,+ column: 0,+ });+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(0);+ });++ it('Value is error', () => {+ const inumber = ErrorValueObject.create(ErrorType.NAME);+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toBe(ErrorType.NAME);+ });++ it('Value is array', () => {+ const inumber = ArrayValueObject.create({+ calculateValueList: transformToValueObject([+ [1, ' ', 1.23, true, false, null],+ [0, '100', '2.34', 'test', -3, ErrorType.NAME],+ ]),+ rowCount: 2,+ columnCount: 6,+ unitId: '',+ sheetId: '',+ row: 0,+ column: 0,+ });+ const result = testFunction.calculate(inumber);+ expect(result.getValue()).toStrictEqual(ErrorType.VALUE);+ });+ });+});diff --git a/packages/engine-formula/src/functions/engineering/imtanh/index.ts b/packages/engine-formula/src/functions/engineering/imtanh/index.tsnew file mode 100644index 0000000000..1731815c82--- /dev/null+++ b/packages/engine-formula/src/functions/engineering/imtanh/index.ts@@ -0,0 +1,60 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import type { BaseValueObject } from '../../../engine/value-object/base-value-object';+import { isRealNum } from '@univerjs/core';+import { Complex } from '../../../basics/complex';+import { ErrorType } from '../../../basics/error-type';+import { checkVariantsErrorIsArrayOrBoolean } from '../../../engine/utils/check-variant-error';+import { ErrorValueObject } from '../../../engine/value-object/base-value-object';+import { NumberValueObject, StringValueObject } from '../../../engine/value-object/primitive-object';+import { BaseFunction } from '../../base-function';++export class Imtanh extends BaseFunction {+ override minParams = 1;++ override maxParams = 1;++ override calculate(inumber: BaseValueObject): BaseValueObject {+ const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(inumber);++ if (isError) {+ return errorObject as ErrorValueObject;+ }++ const [inumberObject] = variants as BaseValueObject[];++ const inumberValue = `${inumberObject.getValue()}`;++ const complex = new Complex(inumberValue);++ if (complex.isError()) {+ return ErrorValueObject.create(ErrorType.NUM);+ }++ const result = complex.Tanh();++ if (complex.isError()) {+ return ErrorValueObject.create(ErrorType.NUM);+ }++ if (typeof result === 'number' || isRealNum(result)) {+ return NumberValueObject.create(+result);+ }++ return StringValueObject.create(result);+ }+}diff --git a/packages/sheets-formula-ui/src/locale/function-list/engineering/en-US.ts b/packages/sheets-formula-ui/src/locale/function-list/engineering/en-US.tsindex 40a705ae72..d2a0dc5d38 100644--- a/packages/sheets-formula-ui/src/locale/function-list/engineering/en-US.ts+++ b/packages/sheets-formula-ui/src/locale/function-list/engineering/en-US.ts@@ -467,6 +467,19 @@ export default {inumber: { name: 'inumber', detail: 'A complex number for which you want the cotangent.' },},},+ IMCOTH: {+ description: 'Returns the hyperbolic cotangent of a complex number',+ abstract: 'Returns the hyperbolic cotangent of a complex number',+ links: [+ {+ title: 'Instruction',+ url: 'https://support.google.com/docs/answer/9366256?hl=en&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: 'inumber', detail: 'A complex number for which you want the hyperbolic cotangent.' },+ },+ },IMCSC: {description: 'Returns the cosecant of a complex number',abstract: 'Returns the cosecant of a complex number',@@ -533,6 +546,20 @@ export default {inumber: { name: 'inumber', detail: 'A complex number for which you want the natural logarithm.' },},},+ IMLOG: {+ description: 'Returns the logarithm of a complex number for a specified base',+ abstract: 'Returns the logarithm of a complex number for a specified base',+ links: [+ {+ title: 'Instruction',+ url: 'https://support.google.com/docs/answer/9366486?hl=zh-Hans&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: 'inumber', detail: 'A complex number whose logarithm to a specific base needs to be calculated.' },+ base: { name: 'base', detail: 'The base to use when calculating the logarithm.' },+ },+ },IMLOG10: {description: 'Returns the base-10 logarithm of a complex number',abstract: 'Returns the base-10 logarithm of a complex number',@@ -706,6 +733,19 @@ export default {inumber: { name: 'inumber', detail: 'A complex number for which you want the tangent.' },},},+ IMTANH: {+ description: 'Returns the hyperbolic tangent of a complex number',+ abstract: 'Returns the hyperbolic tangent of a complex number',+ links: [+ {+ title: 'Instruction',+ url: 'https://support.google.com/docs/answer/9366655?hl=en&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: 'inumber', detail: 'A complex number for which you want the hyperbolic tangent.' },+ },+ },OCT2BIN: {description: 'Converts an octal number to binary',abstract: 'Converts an octal number to binary',diff --git a/packages/sheets-formula-ui/src/locale/function-list/engineering/ja-JP.ts b/packages/sheets-formula-ui/src/locale/function-list/engineering/ja-JP.tsindex 8f0b5361d7..c1ec97ab24 100644--- a/packages/sheets-formula-ui/src/locale/function-list/engineering/ja-JP.ts+++ b/packages/sheets-formula-ui/src/locale/function-list/engineering/ja-JP.ts@@ -467,6 +467,19 @@ export default {inumber: { name: '複素数', detail: '余接を求める複素数を指定します。' },},},+ IMCOTH: {+ description: '複素数の双曲線余接を返します。',+ abstract: '複素数の双曲線余接を返します。',+ links: [+ {+ title: '指導',+ url: 'https://support.google.com/docs/answer/9366256?hl=ja&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: '複素数', detail: '双曲線余接を求める複素数を指定します。' },+ },+ },IMCSC: {description: '複素数の余割を返します。',abstract: '複素数の余割を返します。',@@ -533,6 +546,20 @@ export default {inumber: { name: '複素数', detail: '自然対数を求める複素数を指定します。' },},},+ IMLOG: {+ description: '指定された値を底とする複素数の対数を返します。',+ abstract: '指定された値を底とする複素数の対数を返します。',+ links: [+ {+ title: '指導',+ url: 'https://support.google.com/docs/answer/9366486?hl=ja&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: '複素数', detail: '特定の底に対する対数を計算する必要がある複素数。' },+ base: { name: '底', detail: '対数を求めるときに使用する底です。' },+ },+ },IMLOG10: {description: '複素数の 10 を底とする対数を返します。',abstract: '複素数の 10 を底とする対数を返します。',@@ -706,6 +733,19 @@ export default {inumber: { name: '複素数', detail: '正接を求める接線を指定します。' },},},+ IMTANH: {+ description: '複素数の双曲線正接を返します。',+ abstract: '複素数の双曲線正接を返します。',+ links: [+ {+ title: '指導',+ url: 'https://support.google.com/docs/answer/9366655?hl=ja&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: '複素数', detail: '双曲線正接を求める接線を指定します。' },+ },+ },OCT2BIN: {description: '8 進数を 2 進数に変換します。',abstract: '8 進数を 2 進数に変換します。',diff --git a/packages/sheets-formula-ui/src/locale/function-list/engineering/vi-VN.ts b/packages/sheets-formula-ui/src/locale/function-list/engineering/vi-VN.tsindex 5baf5f08ed..bd7cba0c87 100644--- a/packages/sheets-formula-ui/src/locale/function-list/engineering/vi-VN.ts+++ b/packages/sheets-formula-ui/src/locale/function-list/engineering/vi-VN.ts@@ -468,6 +468,19 @@ export default {inumber: { name: 'số phức', detail: 'Số phức mà bạn muốn lấy cotangent.' },},},+ IMCOTH: {+ description: 'Trả về hyperbolic cotangent của số phức',+ abstract: 'Trả về hyperbolic cotangent của số phức',+ links: [+ {+ title: 'Giảng dạy',+ url: 'https://support.google.com/docs/answer/9366256?hl=vi&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: 'số phức', detail: 'Số phức mà bạn muốn lấy hyperbolic cotangent.' },+ },+ },IMCSC: {description: 'Trả về cosecant của số phức',abstract: 'Trả về cosecant của số phức',@@ -534,6 +547,20 @@ export default {inumber: { name: 'số phức', detail: 'Số phức mà bạn muốn tìm lô-ga-rit tự nhiên của nó.' },},},+ IMLOG: {+ description: 'Trả về logarithm của một số phức với cơ số xác định.',+ abstract: 'Trả về logarithm của một số phức với cơ số xác định.',+ links: [+ {+ title: 'Giảng dạy',+ url: 'https://support.google.com/docs/answer/9366486?hl=vi&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: 'số phức', detail: 'Một số phức có logarit theo một cơ số cụ thể cần được tính.' },+ base: { name: 'cơ số', detail: 'Cơ số cần sử dụng khi tính lôgarit.' },+ },+ },IMLOG10: {description: 'Trả về logarithm cơ số 10 của số phức',abstract: 'Trả về logarithm cơ số 10 của số phức',@@ -705,7 +732,20 @@ export default {},],functionParameter: {- inumber: { name: 'số phức', detail: 'Số phức mà bạn muốn lấy tang.' },+ inumber: { name: 'số phức', detail: 'Số phức mà bạn muốn lấy tan.' },+ },+ },+ IMTANH: {+ description: 'Trả về tanh của số phức',+ abstract: 'Trả về tanh của số phức',+ links: [+ {+ title: 'Giảng dạy',+ url: 'https://support.google.com/docs/answer/9366655?hl=vi&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: 'số phức', detail: 'Số phức mà bạn muốn lấy tanh.' },},},OCT2BIN: {diff --git a/packages/sheets-formula-ui/src/locale/function-list/engineering/zh-CN.ts b/packages/sheets-formula-ui/src/locale/function-list/engineering/zh-CN.tsindex bf28f52c02..72ad751642 100644--- a/packages/sheets-formula-ui/src/locale/function-list/engineering/zh-CN.ts+++ b/packages/sheets-formula-ui/src/locale/function-list/engineering/zh-CN.ts@@ -438,7 +438,7 @@ export default {},],functionParameter: {- inumber: { name: '复数', detail: '需要计算其余弦的复数。' },+ inumber: { name: '复数', detail: '需要计算其余弦值的复数。' },},},IMCOSH: {@@ -464,7 +464,20 @@ export default {},],functionParameter: {- inumber: { name: '复数', detail: '需要计算其余切的复数。' },+ inumber: { name: '复数', detail: '需要计算其余切值的复数。' },+ },+ },+ IMCOTH: {+ description: '返回复数的双曲余切值',+ abstract: '返回复数的双曲余切值',+ links: [+ {+ title: '教学',+ url: 'https://support.google.com/docs/answer/9366256?hl=zh-Hans&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: '复数', detail: '需要计算其双曲余切值的复数。' },},},IMCSC: {@@ -533,6 +546,20 @@ export default {inumber: { name: '复数', detail: '需要计算其自然对数的复数。' },},},+ IMLOG: {+ description: '返回复数的以特定数为底的对数',+ abstract: '返回复数的以特定数为底的对数',+ links: [+ {+ title: '教学',+ url: 'https://support.google.com/docs/answer/9366486?hl=zh-Hans&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: '复数', detail: '需要计算其以特定数为底的对数的复数。' },+ base: { name: '底数', detail: '用于计算相应对数的底数。' },+ },+ },IMLOG10: {description: '返回复数的以 10 为底的对数',abstract: '返回复数的以 10 为底的对数',@@ -706,6 +733,19 @@ export default {inumber: { name: '复数', detail: '需要计算其正切值的复数。' },},},+ IMTANH: {+ description: '返回复数的双曲正切值',+ abstract: '返回复数的双曲正切值',+ links: [+ {+ title: '教学',+ url: 'https://support.google.com/docs/answer/9366655?hl=zh-Hans&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: '复数', detail: '需要计算其双曲正切值的复数。' },+ },+ },OCT2BIN: {description: '将八进制数转换为二进制数',abstract: '将八进制数转换为二进制数',diff --git a/packages/sheets-formula-ui/src/locale/function-list/engineering/zh-TW.ts b/packages/sheets-formula-ui/src/locale/function-list/engineering/zh-TW.tsindex a51c965a35..a2e9d281ad 100644--- a/packages/sheets-formula-ui/src/locale/function-list/engineering/zh-TW.ts+++ b/packages/sheets-formula-ui/src/locale/function-list/engineering/zh-TW.ts@@ -467,6 +467,19 @@ export default {inumber: { name: '複數', detail: '要求得餘切值的複數。' },},},+ IMCOTH: {+ description: '傳回複數的雙曲餘切值',+ abstract: '傳回複數的雙曲餘切值',+ links: [+ {+ title: '教学',+ url: 'https://support.google.com/docs/answer/9366256?hl=zh-Hant&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: '複數', detail: '這是要求得雙曲餘切值的複數。' },+ },+ },IMCSC: {description: '傳回複數的餘割值',abstract: '傳回複數的餘割值',@@ -533,6 +546,20 @@ export default {inumber: { name: '複數', detail: '要求得自然對數的複數。' },},},+ IMLOG: {+ description: '傳回複數的以特定底數的對數',+ abstract: '傳回複數的以特定底數的對數',+ links: [+ {+ title: '教導',+ url: 'https://support.google.com/docs/answer/9366486?hl=zh-Hant&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: '複數', detail: '這是要求得以特定底數的對數的複數。' },+ base: { name: '底數', detail: '計算對數時所用的底數。' },+ },+ },IMLOG10: {description: '傳回複數的以 10 為底的對數',abstract: '傳回複數的以 10 為底的對數',@@ -706,6 +733,19 @@ export default {inumber: { name: '複數', detail: '要求得正切值的複數。' },},},+ IMTANH: {+ description: '傳回複數的雙曲正切值',+ abstract: '傳回複數的雙曲正切值',+ links: [+ {+ title: '教導',+ url: 'https://support.google.com/docs/answer/9366655?hl=zh-Hant&sjid=1719420110567985051-AP',+ },+ ],+ functionParameter: {+ inumber: { name: '複數', detail: '這是要求得雙曲正切值的複數。' },+ },+ },OCT2BIN: {description: '將八進制數轉換為二進制數',abstract: '將八進位數轉換為二進位數',diff --git a/packages/sheets-formula/src/services/function-list/engineering.ts b/packages/sheets-formula/src/services/function-list/engineering.tsindex b2eef865da..f04620696d 100644--- a/packages/sheets-formula/src/services/function-list/engineering.ts+++ b/packages/sheets-formula/src/services/function-list/engineering.ts@@ -673,6 +673,21 @@ export const FUNCTION_LIST_ENGINEERING: IFunctionInfo[] = [},],},+ {+ functionName: FUNCTION_NAMES_ENGINEERING.IMCOTH,+ functionType: FunctionType.Engineering,+ description: 'formula.functionList.IMCOTH.description',+ abstract: 'formula.functionList.IMCOTH.abstract',+ functionParameter: [+ {+ name: 'formula.functionList.IMCOTH.functionParameter.inumber.name',+ detail: 'formula.functionList.IMCOTH.functionParameter.inumber.detail',+ example: '"4+3i"',+ require: 1,+ repeat: 0,+ },+ ],+ },{functionName: FUNCTION_NAMES_ENGINEERING.IMCSC,functionType: FunctionType.Engineering,@@ -755,6 +770,28 @@ export const FUNCTION_LIST_ENGINEERING: IFunctionInfo[] = [},],},+ {+ functionName: FUNCTION_NAMES_ENGINEERING.IMLOG,+ functionType: FunctionType.Engineering,+ description: 'formula.functionList.IMLOG.description',+ abstract: 'formula.functionList.IMLOG.abstract',+ functionParameter: [+ {+ name: 'formula.functionList.IMLOG.functionParameter.inumber.name',+ detail: 'formula.functionList.IMLOG.functionParameter.inumber.detail',+ example: '"3+4i"',+ require: 1,+ repeat: 0,+ },+ {+ name: 'formula.functionList.IMLOG.functionParameter.base.name',+ detail: 'formula.functionList.IMLOG.functionParameter.base.detail',+ example: '10',+ require: 0,+ repeat: 0,+ },+ ],+ },{functionName: FUNCTION_NAMES_ENGINEERING.IMLOG10,functionType: FunctionType.Engineering,@@ -978,6 +1015,21 @@ export const FUNCTION_LIST_ENGINEERING: IFunctionInfo[] = [},],},+ {+ functionName: FUNCTION_NAMES_ENGINEERING.IMTANH,+ functionType: FunctionType.Engineering,+ description: 'formula.functionList.IMTANH.description',+ abstract: 'formula.functionList.IMTANH.abstract',+ functionParameter: [+ {+ name: 'formula.functionList.IMTANH.functionParameter.inumber.name',+ detail: 'formula.functionList.IMTANH.functionParameter.inumber.detail',+ example: '"4+3i"',+ require: 1,+ repeat: 0,+ },+ ],+ },{functionName: FUNCTION_NAMES_ENGINEERING.OCT2BIN,functionType: FunctionType.Engineering,