@syncfusion/ej2-calculate 35.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +263 -0
- package/README.md +132 -0
- package/base.d.ts +4 -0
- package/base.js +4 -0
- package/common.d.ts +4 -0
- package/common.js +4 -0
- package/dist/ej2-calculate.umd.min.js +11 -0
- package/dist/ej2-calculate.umd.min.js.map +1 -0
- package/dist/es6/ej2-calculate.es2015.js +24801 -0
- package/dist/es6/ej2-calculate.es2015.js.map +1 -0
- package/dist/es6/ej2-calculate.es5.js +27229 -0
- package/dist/es6/ej2-calculate.es5.js.map +1 -0
- package/dist/global/ej2-calculate.min.js +11 -0
- package/dist/global/ej2-calculate.min.js.map +1 -0
- package/dist/global/index.d.ts +14 -0
- package/formulas.d.ts +4 -0
- package/formulas.js +4 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/license +10 -0
- package/package.json +30 -0
- package/src/base/calculate-model.d.ts +4 -0
- package/src/base/calculate-model.js +0 -0
- package/src/base/calculate.d.ts +1105 -0
- package/src/base/calculate.js +4720 -0
- package/src/base/index.d.ts +8 -0
- package/src/base/index.js +7 -0
- package/src/base/parser.d.ts +208 -0
- package/src/base/parser.js +1512 -0
- package/src/common/address.d.ts +59 -0
- package/src/common/address.js +96 -0
- package/src/common/cell-ref.d.ts +32 -0
- package/src/common/cell-ref.js +112 -0
- package/src/common/common.d.ts +44 -0
- package/src/common/common.js +134 -0
- package/src/common/enum.d.ts +94 -0
- package/src/common/enum.js +97 -0
- package/src/common/index.d.ts +9 -0
- package/src/common/index.js +8 -0
- package/src/common/interface.d.ts +122 -0
- package/src/common/interface.js +0 -0
- package/src/common/l10n.d.ts +24 -0
- package/src/common/l10n.js +54 -0
- package/src/common/number-date.d.ts +26 -0
- package/src/common/number-date.js +38 -0
- package/src/common/sheet-info.d.ts +10 -0
- package/src/common/sheet-info.js +17 -0
- package/src/common/sort.d.ts +17 -0
- package/src/common/sort.js +44 -0
- package/src/formulas/array.d.ts +47 -0
- package/src/formulas/array.js +718 -0
- package/src/formulas/basic.d.ts +47 -0
- package/src/formulas/basic.js +181 -0
- package/src/formulas/complex-numbers.d.ts +207 -0
- package/src/formulas/complex-numbers.js +549 -0
- package/src/formulas/database.d.ts +152 -0
- package/src/formulas/database.js +579 -0
- package/src/formulas/date-time-extra.d.ts +97 -0
- package/src/formulas/date-time-extra.js +415 -0
- package/src/formulas/date-time-intl.d.ts +57 -0
- package/src/formulas/date-time-intl.js +309 -0
- package/src/formulas/date-time.d.ts +164 -0
- package/src/formulas/date-time.js +1021 -0
- package/src/formulas/engineering-base.d.ts +150 -0
- package/src/formulas/engineering-base.js +404 -0
- package/src/formulas/engineering-bessel.d.ts +65 -0
- package/src/formulas/engineering-bessel.js +167 -0
- package/src/formulas/engineering-convert.d.ts +35 -0
- package/src/formulas/engineering-convert.js +120 -0
- package/src/formulas/engineering-misc.d.ts +64 -0
- package/src/formulas/engineering-misc.js +168 -0
- package/src/formulas/financial-amortization-ecma.d.ts +87 -0
- package/src/formulas/financial-amortization-ecma.js +288 -0
- package/src/formulas/financial-annuity.d.ts +104 -0
- package/src/formulas/financial-annuity.js +419 -0
- package/src/formulas/financial-bond-helpers.d.ts +106 -0
- package/src/formulas/financial-bond-helpers.js +190 -0
- package/src/formulas/financial-cashflow.d.ts +47 -0
- package/src/formulas/financial-cashflow.js +203 -0
- package/src/formulas/financial-coupons.d.ts +227 -0
- package/src/formulas/financial-coupons.js +810 -0
- package/src/formulas/financial-depreciation.d.ts +64 -0
- package/src/formulas/financial-depreciation.js +247 -0
- package/src/formulas/financial-rates.d.ts +54 -0
- package/src/formulas/financial-rates.js +140 -0
- package/src/formulas/financial-securities.d.ts +126 -0
- package/src/formulas/financial-securities.js +488 -0
- package/src/formulas/formula-math-helpers.d.ts +212 -0
- package/src/formulas/formula-math-helpers.js +599 -0
- package/src/formulas/formula-module-base.d.ts +54 -0
- package/src/formulas/formula-module-base.js +125 -0
- package/src/formulas/formula-owner.d.ts +17 -0
- package/src/formulas/formula-owner.js +0 -0
- package/src/formulas/index.d.ts +68 -0
- package/src/formulas/index.js +67 -0
- package/src/formulas/information-advanced.d.ts +44 -0
- package/src/formulas/information-advanced.js +157 -0
- package/src/formulas/information-ecma.d.ts +33 -0
- package/src/formulas/information-ecma.js +88 -0
- package/src/formulas/information-extra.d.ts +146 -0
- package/src/formulas/information-extra.js +351 -0
- package/src/formulas/information.d.ts +34 -0
- package/src/formulas/information.js +78 -0
- package/src/formulas/logical-extra.d.ts +75 -0
- package/src/formulas/logical-extra.js +217 -0
- package/src/formulas/logical.d.ts +83 -0
- package/src/formulas/logical.js +296 -0
- package/src/formulas/lookup-array.d.ts +98 -0
- package/src/formulas/lookup-array.js +364 -0
- package/src/formulas/lookup-ref-extra.d.ts +64 -0
- package/src/formulas/lookup-ref-extra.js +180 -0
- package/src/formulas/lookup-ref.d.ts +84 -0
- package/src/formulas/lookup-ref.js +263 -0
- package/src/formulas/lookup.d.ts +114 -0
- package/src/formulas/lookup.js +881 -0
- package/src/formulas/math-aggregate.d.ts +74 -0
- package/src/formulas/math-aggregate.js +376 -0
- package/src/formulas/math-ceiling-ecma.d.ts +42 -0
- package/src/formulas/math-ceiling-ecma.js +123 -0
- package/src/formulas/math-combinatorics.d.ts +75 -0
- package/src/formulas/math-combinatorics.js +290 -0
- package/src/formulas/math-misc.d.ts +164 -0
- package/src/formulas/math-misc.js +889 -0
- package/src/formulas/math-number.d.ts +76 -0
- package/src/formulas/math-number.js +261 -0
- package/src/formulas/math-rounding.d.ts +115 -0
- package/src/formulas/math-rounding.js +728 -0
- package/src/formulas/math-trig-hyperbolic.d.ts +55 -0
- package/src/formulas/math-trig-hyperbolic.js +113 -0
- package/src/formulas/math-trig.d.ts +165 -0
- package/src/formulas/math-trig.js +334 -0
- package/src/formulas/matrix-base.d.ts +13 -0
- package/src/formulas/matrix-base.js +169 -0
- package/src/formulas/matrix.d.ts +64 -0
- package/src/formulas/matrix.js +161 -0
- package/src/formulas/regression-ecma.d.ts +66 -0
- package/src/formulas/regression-ecma.js +234 -0
- package/src/formulas/statistical-advanced.d.ts +125 -0
- package/src/formulas/statistical-advanced.js +756 -0
- package/src/formulas/statistical-correlation.d.ts +75 -0
- package/src/formulas/statistical-correlation.js +198 -0
- package/src/formulas/statistical-dispersion.d.ts +108 -0
- package/src/formulas/statistical-dispersion.js +337 -0
- package/src/formulas/statistical-distribution-extended.d.ts +176 -0
- package/src/formulas/statistical-distribution-extended.js +668 -0
- package/src/formulas/statistical-distribution.d.ts +104 -0
- package/src/formulas/statistical-distribution.js +368 -0
- package/src/formulas/statistical-ecma.d.ts +95 -0
- package/src/formulas/statistical-ecma.js +392 -0
- package/src/formulas/statistical-extended.d.ts +136 -0
- package/src/formulas/statistical-extended.js +340 -0
- package/src/formulas/statistical-ifs.d.ts +46 -0
- package/src/formulas/statistical-ifs.js +180 -0
- package/src/formulas/statistical-moments.d.ts +84 -0
- package/src/formulas/statistical-moments.js +269 -0
- package/src/formulas/statistical-percentile.d.ts +56 -0
- package/src/formulas/statistical-percentile.js +195 -0
- package/src/formulas/statistical-sample-base.d.ts +14 -0
- package/src/formulas/statistical-sample-base.js +124 -0
- package/src/formulas/statistical.d.ts +135 -0
- package/src/formulas/statistical.js +542 -0
- package/src/formulas/text-advanced.d.ts +64 -0
- package/src/formulas/text-advanced.js +222 -0
- package/src/formulas/text-ecma.d.ts +54 -0
- package/src/formulas/text-ecma.js +106 -0
- package/src/formulas/text-extra.d.ts +216 -0
- package/src/formulas/text-extra.js +657 -0
- package/src/formulas/text.d.ts +125 -0
- package/src/formulas/text.js +628 -0
- package/src/global.js +1 -0
- package/src/index.d.ts +14 -0
- package/src/index.js +14 -0
- package/tslint.json +111 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { IBasicFormula } from '../common/index';
|
|
2
|
+
import { FormulaOwner } from './formula-owner';
|
|
3
|
+
import { FormulaModuleBase } from './formula-module-base';
|
|
4
|
+
/**
|
|
5
|
+
* Hyperbolic trigonometric functions and their inverses for exponential growth/decay modeling.
|
|
6
|
+
*
|
|
7
|
+
* Registered functions: ACOSH, ASINH, ATANH.
|
|
8
|
+
*
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export declare class MathTrigHyperbolicFormulas extends FormulaModuleBase {
|
|
12
|
+
/** Formula definitions registered with {@link BasicFormulas}. */
|
|
13
|
+
formulas: IBasicFormula[];
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
* @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
|
|
17
|
+
*/
|
|
18
|
+
constructor(owner: FormulaOwner);
|
|
19
|
+
private unaryMath;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the inverse hyperbolic cosine of a number.
|
|
22
|
+
*
|
|
23
|
+
* Excel: `ACOSH(...)`.
|
|
24
|
+
*
|
|
25
|
+
* @hidden
|
|
26
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
27
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* engine.computeFormula('=ACOSH(1)');
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
ComputeACOSH(...args: string[]): string | number;
|
|
35
|
+
/**
|
|
36
|
+
* Returns the inverse hyperbolic sine of a number.
|
|
37
|
+
*
|
|
38
|
+
* Excel: `ASINH(...)`.
|
|
39
|
+
*
|
|
40
|
+
* @hidden
|
|
41
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
42
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
43
|
+
*/
|
|
44
|
+
ComputeASINH(...args: string[]): string | number;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the inverse hyperbolic tangent of a number.
|
|
47
|
+
*
|
|
48
|
+
* Excel: `ATANH(...)`.
|
|
49
|
+
*
|
|
50
|
+
* @hidden
|
|
51
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
52
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
53
|
+
*/
|
|
54
|
+
ComputeATANH(...args: string[]): string | number;
|
|
55
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
import { FormulasErrorsStrings, CommonErrors } from '../common/index';
|
|
15
|
+
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
16
|
+
import { FormulaModuleBase } from './formula-module-base';
|
|
17
|
+
/**
|
|
18
|
+
* Hyperbolic trigonometric functions and their inverses for exponential growth/decay modeling.
|
|
19
|
+
*
|
|
20
|
+
* Registered functions: ACOSH, ASINH, ATANH.
|
|
21
|
+
*
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
var MathTrigHyperbolicFormulas = /** @class */ (function (_super) {
|
|
25
|
+
__extends(MathTrigHyperbolicFormulas, _super);
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
* @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
|
|
29
|
+
*/
|
|
30
|
+
function MathTrigHyperbolicFormulas(owner) {
|
|
31
|
+
var _this = _super.call(this, owner) || this;
|
|
32
|
+
/** Formula definitions registered with {@link BasicFormulas}. */
|
|
33
|
+
_this.formulas = [
|
|
34
|
+
{ formulaName: 'ACOSH', category: 'Math & Trig', description: 'Returns the inverse hyperbolic cosine of a number.' },
|
|
35
|
+
{ formulaName: 'ASINH', category: 'Math & Trig', description: 'Returns the inverse hyperbolic sine of a number.' },
|
|
36
|
+
{ formulaName: 'ATANH', category: 'Math & Trig', description: 'Returns the inverse hyperbolic tangent of a number.' }
|
|
37
|
+
];
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
MathTrigHyperbolicFormulas.prototype.unaryMath = function (args, fn, domainCheck) {
|
|
41
|
+
var errCollection = this.parent.getErrorStrings();
|
|
42
|
+
if (isNullOrUndefined(args) || args.length !== 1 || args[0] === '') {
|
|
43
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
44
|
+
}
|
|
45
|
+
var num = this.resolveNumberArg(args[0]);
|
|
46
|
+
if (typeof num === 'string') {
|
|
47
|
+
return num;
|
|
48
|
+
}
|
|
49
|
+
if (domainCheck && !domainCheck(num)) {
|
|
50
|
+
return errCollection[CommonErrors.Num];
|
|
51
|
+
}
|
|
52
|
+
var result = fn(num);
|
|
53
|
+
if (!isFinite(result)) {
|
|
54
|
+
return errCollection[CommonErrors.Num];
|
|
55
|
+
}
|
|
56
|
+
return result.toString();
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Returns the inverse hyperbolic cosine of a number.
|
|
60
|
+
*
|
|
61
|
+
* Excel: `ACOSH(...)`.
|
|
62
|
+
*
|
|
63
|
+
* @hidden
|
|
64
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
65
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* engine.computeFormula('=ACOSH(1)');
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
MathTrigHyperbolicFormulas.prototype.ComputeACOSH = function () {
|
|
73
|
+
var args = [];
|
|
74
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
75
|
+
args[_i] = arguments[_i];
|
|
76
|
+
}
|
|
77
|
+
return this.unaryMath(args, Math.acosh, function (n) { return n >= 1; });
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Returns the inverse hyperbolic sine of a number.
|
|
81
|
+
*
|
|
82
|
+
* Excel: `ASINH(...)`.
|
|
83
|
+
*
|
|
84
|
+
* @hidden
|
|
85
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
86
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
87
|
+
*/
|
|
88
|
+
MathTrigHyperbolicFormulas.prototype.ComputeASINH = function () {
|
|
89
|
+
var args = [];
|
|
90
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
91
|
+
args[_i] = arguments[_i];
|
|
92
|
+
}
|
|
93
|
+
return this.unaryMath(args, Math.asinh);
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Returns the inverse hyperbolic tangent of a number.
|
|
97
|
+
*
|
|
98
|
+
* Excel: `ATANH(...)`.
|
|
99
|
+
*
|
|
100
|
+
* @hidden
|
|
101
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
102
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
103
|
+
*/
|
|
104
|
+
MathTrigHyperbolicFormulas.prototype.ComputeATANH = function () {
|
|
105
|
+
var args = [];
|
|
106
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
107
|
+
args[_i] = arguments[_i];
|
|
108
|
+
}
|
|
109
|
+
return this.unaryMath(args, Math.atanh, function (n) { return n > -1 && n < 1; });
|
|
110
|
+
};
|
|
111
|
+
return MathTrigHyperbolicFormulas;
|
|
112
|
+
}(FormulaModuleBase));
|
|
113
|
+
export { MathTrigHyperbolicFormulas };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { IBasicFormula } from '../common/index';
|
|
2
|
+
import { FormulaOwner } from './formula-owner';
|
|
3
|
+
import { FormulaModuleBase } from './formula-module-base';
|
|
4
|
+
/**
|
|
5
|
+
* Standard trigonometric functions (SIN, COS, TAN, and inverses) operating on angles in radians.
|
|
6
|
+
*
|
|
7
|
+
* Registers 14 functions including SIN, COS, TAN, ASIN, ACOS, and others.
|
|
8
|
+
*
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export declare class MathTrigFormulas extends FormulaModuleBase {
|
|
12
|
+
/** Formula definitions registered with {@link BasicFormulas}. */
|
|
13
|
+
formulas: IBasicFormula[];
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
* @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
|
|
17
|
+
*/
|
|
18
|
+
constructor(owner: FormulaOwner);
|
|
19
|
+
private unaryMath;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the sine of an angle.
|
|
22
|
+
*
|
|
23
|
+
* Excel: `SIN(...)`.
|
|
24
|
+
*
|
|
25
|
+
* @hidden
|
|
26
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
27
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* engine.computeFormula('=SIN(1)');
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
ComputeSIN(...args: string[]): string | number;
|
|
35
|
+
/**
|
|
36
|
+
* Returns the cosine of an angle.
|
|
37
|
+
*
|
|
38
|
+
* Excel: `COS(...)`.
|
|
39
|
+
*
|
|
40
|
+
* @hidden
|
|
41
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
42
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
43
|
+
*/
|
|
44
|
+
ComputeCOS(...args: string[]): string | number;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the tangent of an angle.
|
|
47
|
+
*
|
|
48
|
+
* Excel: `TAN(...)`.
|
|
49
|
+
*
|
|
50
|
+
* @hidden
|
|
51
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
52
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
53
|
+
*/
|
|
54
|
+
ComputeTAN(...args: string[]): string | number;
|
|
55
|
+
/**
|
|
56
|
+
* Returns the arcsine of a number.
|
|
57
|
+
*
|
|
58
|
+
* Excel: `ASIN(...)`.
|
|
59
|
+
*
|
|
60
|
+
* @hidden
|
|
61
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
62
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
63
|
+
*/
|
|
64
|
+
ComputeASIN(...args: string[]): string | number;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the arccosine of a number.
|
|
67
|
+
*
|
|
68
|
+
* Excel: `ACOS(...)`.
|
|
69
|
+
*
|
|
70
|
+
* @hidden
|
|
71
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
72
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
73
|
+
*/
|
|
74
|
+
ComputeACOS(...args: string[]): string | number;
|
|
75
|
+
/**
|
|
76
|
+
* Returns the arctangent of a number.
|
|
77
|
+
*
|
|
78
|
+
* Excel: `ATAN(...)`.
|
|
79
|
+
*
|
|
80
|
+
* @hidden
|
|
81
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
82
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
83
|
+
*/
|
|
84
|
+
ComputeATAN(...args: string[]): string | number;
|
|
85
|
+
/**
|
|
86
|
+
* Returns the hyperbolic sine of a number.
|
|
87
|
+
*
|
|
88
|
+
* Excel: `SINH(...)`.
|
|
89
|
+
*
|
|
90
|
+
* @hidden
|
|
91
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
92
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
93
|
+
*/
|
|
94
|
+
ComputeSINH(...args: string[]): string | number;
|
|
95
|
+
/**
|
|
96
|
+
* Returns the hyperbolic cosine of a number.
|
|
97
|
+
*
|
|
98
|
+
* Excel: `COSH(...)`.
|
|
99
|
+
*
|
|
100
|
+
* @hidden
|
|
101
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
102
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
103
|
+
*/
|
|
104
|
+
ComputeCOSH(...args: string[]): string | number;
|
|
105
|
+
/**
|
|
106
|
+
* Returns the hyperbolic tangent of a number.
|
|
107
|
+
*
|
|
108
|
+
* Excel: `TANH(...)`.
|
|
109
|
+
*
|
|
110
|
+
* @hidden
|
|
111
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
112
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
113
|
+
*/
|
|
114
|
+
ComputeTANH(...args: string[]): string | number;
|
|
115
|
+
/**
|
|
116
|
+
* Returns the base-10 logarithm of a number.
|
|
117
|
+
*
|
|
118
|
+
* Excel: `LOG10(...)`.
|
|
119
|
+
*
|
|
120
|
+
* @hidden
|
|
121
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
122
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
123
|
+
*/
|
|
124
|
+
ComputeLOG10(...args: string[]): string | number;
|
|
125
|
+
/**
|
|
126
|
+
* Returns the square root of a number multiplied by pi.
|
|
127
|
+
*
|
|
128
|
+
* Excel: `SQRTPI(...)`.
|
|
129
|
+
*
|
|
130
|
+
* @hidden
|
|
131
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
132
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
133
|
+
*/
|
|
134
|
+
ComputeSQRTPI(...args: string[]): string | number;
|
|
135
|
+
/**
|
|
136
|
+
* Returns the arctangent from x- and y-coordinates.
|
|
137
|
+
*
|
|
138
|
+
* Excel: `ATAN2(...)`.
|
|
139
|
+
*
|
|
140
|
+
* @hidden
|
|
141
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
142
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
143
|
+
*/
|
|
144
|
+
ComputeATAN2(...args: string[]): string | number;
|
|
145
|
+
/**
|
|
146
|
+
* Returns the sign of a number.
|
|
147
|
+
*
|
|
148
|
+
* Excel: `SIGN(...)`.
|
|
149
|
+
*
|
|
150
|
+
* @hidden
|
|
151
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
152
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
153
|
+
*/
|
|
154
|
+
ComputeSIGN(...args: string[]): string | number;
|
|
155
|
+
/**
|
|
156
|
+
* Returns the integer portion of a division.
|
|
157
|
+
*
|
|
158
|
+
* Excel: `QUOTIENT(...)`.
|
|
159
|
+
*
|
|
160
|
+
* @hidden
|
|
161
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
162
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
163
|
+
*/
|
|
164
|
+
ComputeQUOTIENT(...args: string[]): string | number;
|
|
165
|
+
}
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
import { FormulasErrorsStrings, CommonErrors } from '../common/index';
|
|
15
|
+
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
16
|
+
import { FormulaModuleBase } from './formula-module-base';
|
|
17
|
+
/**
|
|
18
|
+
* Standard trigonometric functions (SIN, COS, TAN, and inverses) operating on angles in radians.
|
|
19
|
+
*
|
|
20
|
+
* Registers 14 functions including SIN, COS, TAN, ASIN, ACOS, and others.
|
|
21
|
+
*
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
var MathTrigFormulas = /** @class */ (function (_super) {
|
|
25
|
+
__extends(MathTrigFormulas, _super);
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
* @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
|
|
29
|
+
*/
|
|
30
|
+
function MathTrigFormulas(owner) {
|
|
31
|
+
var _this = _super.call(this, owner) || this;
|
|
32
|
+
/** Formula definitions registered with {@link BasicFormulas}. */
|
|
33
|
+
_this.formulas = [
|
|
34
|
+
{ formulaName: 'SIN', category: 'Math & Trig', description: 'Returns the sine of an angle.' },
|
|
35
|
+
{ formulaName: 'COS', category: 'Math & Trig', description: 'Returns the cosine of an angle.' },
|
|
36
|
+
{ formulaName: 'TAN', category: 'Math & Trig', description: 'Returns the tangent of an angle.' },
|
|
37
|
+
{ formulaName: 'ASIN', category: 'Math & Trig', description: 'Returns the arcsine of a number.' },
|
|
38
|
+
{ formulaName: 'ACOS', category: 'Math & Trig', description: 'Returns the arccosine of a number.' },
|
|
39
|
+
{ formulaName: 'ATAN', category: 'Math & Trig', description: 'Returns the arctangent of a number.' },
|
|
40
|
+
{ formulaName: 'ATAN2', category: 'Math & Trig', description: 'Returns the arctangent from x- and y-coordinates.' },
|
|
41
|
+
{ formulaName: 'SINH', category: 'Math & Trig', description: 'Returns the hyperbolic sine of a number.' },
|
|
42
|
+
{ formulaName: 'COSH', category: 'Math & Trig', description: 'Returns the hyperbolic cosine of a number.' },
|
|
43
|
+
{ formulaName: 'TANH', category: 'Math & Trig', description: 'Returns the hyperbolic tangent of a number.' },
|
|
44
|
+
{ formulaName: 'SIGN', category: 'Math & Trig', description: 'Returns the sign of a number.' },
|
|
45
|
+
{ formulaName: 'LOG10', category: 'Math & Trig', description: 'Returns the base-10 logarithm of a number.' },
|
|
46
|
+
{ formulaName: 'QUOTIENT', category: 'Math & Trig', description: 'Returns the integer portion of a division.' },
|
|
47
|
+
{ formulaName: 'SQRTPI', category: 'Math & Trig', description: 'Returns the square root of a number multiplied by pi.' }
|
|
48
|
+
];
|
|
49
|
+
return _this;
|
|
50
|
+
}
|
|
51
|
+
MathTrigFormulas.prototype.unaryMath = function (args, fn, domainCheck) {
|
|
52
|
+
var errCollection = this.parent.getErrorStrings();
|
|
53
|
+
if (isNullOrUndefined(args) || args.length !== 1 || args[0] === '') {
|
|
54
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
55
|
+
}
|
|
56
|
+
var num = this.resolveNumberArg(args[0]);
|
|
57
|
+
if (typeof num === 'string') {
|
|
58
|
+
return num;
|
|
59
|
+
}
|
|
60
|
+
if (domainCheck && !domainCheck(num)) {
|
|
61
|
+
return errCollection[CommonErrors.Num];
|
|
62
|
+
}
|
|
63
|
+
return fn(num).toString();
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Returns the sine of an angle.
|
|
67
|
+
*
|
|
68
|
+
* Excel: `SIN(...)`.
|
|
69
|
+
*
|
|
70
|
+
* @hidden
|
|
71
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
72
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* engine.computeFormula('=SIN(1)');
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
MathTrigFormulas.prototype.ComputeSIN = function () {
|
|
80
|
+
var args = [];
|
|
81
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
82
|
+
args[_i] = arguments[_i];
|
|
83
|
+
}
|
|
84
|
+
return this.unaryMath(args, Math.sin);
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Returns the cosine of an angle.
|
|
88
|
+
*
|
|
89
|
+
* Excel: `COS(...)`.
|
|
90
|
+
*
|
|
91
|
+
* @hidden
|
|
92
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
93
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
94
|
+
*/
|
|
95
|
+
MathTrigFormulas.prototype.ComputeCOS = function () {
|
|
96
|
+
var args = [];
|
|
97
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
98
|
+
args[_i] = arguments[_i];
|
|
99
|
+
}
|
|
100
|
+
return this.unaryMath(args, Math.cos);
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Returns the tangent of an angle.
|
|
104
|
+
*
|
|
105
|
+
* Excel: `TAN(...)`.
|
|
106
|
+
*
|
|
107
|
+
* @hidden
|
|
108
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
109
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
110
|
+
*/
|
|
111
|
+
MathTrigFormulas.prototype.ComputeTAN = function () {
|
|
112
|
+
var args = [];
|
|
113
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
114
|
+
args[_i] = arguments[_i];
|
|
115
|
+
}
|
|
116
|
+
return this.unaryMath(args, Math.tan);
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Returns the arcsine of a number.
|
|
120
|
+
*
|
|
121
|
+
* Excel: `ASIN(...)`.
|
|
122
|
+
*
|
|
123
|
+
* @hidden
|
|
124
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
125
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
126
|
+
*/
|
|
127
|
+
MathTrigFormulas.prototype.ComputeASIN = function () {
|
|
128
|
+
var args = [];
|
|
129
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
130
|
+
args[_i] = arguments[_i];
|
|
131
|
+
}
|
|
132
|
+
return this.unaryMath(args, Math.asin, function (n) { return n >= -1 && n <= 1; });
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Returns the arccosine of a number.
|
|
136
|
+
*
|
|
137
|
+
* Excel: `ACOS(...)`.
|
|
138
|
+
*
|
|
139
|
+
* @hidden
|
|
140
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
141
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
142
|
+
*/
|
|
143
|
+
MathTrigFormulas.prototype.ComputeACOS = function () {
|
|
144
|
+
var args = [];
|
|
145
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
146
|
+
args[_i] = arguments[_i];
|
|
147
|
+
}
|
|
148
|
+
return this.unaryMath(args, Math.acos, function (n) { return n >= -1 && n <= 1; });
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Returns the arctangent of a number.
|
|
152
|
+
*
|
|
153
|
+
* Excel: `ATAN(...)`.
|
|
154
|
+
*
|
|
155
|
+
* @hidden
|
|
156
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
157
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
158
|
+
*/
|
|
159
|
+
MathTrigFormulas.prototype.ComputeATAN = function () {
|
|
160
|
+
var args = [];
|
|
161
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
162
|
+
args[_i] = arguments[_i];
|
|
163
|
+
}
|
|
164
|
+
return this.unaryMath(args, Math.atan);
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Returns the hyperbolic sine of a number.
|
|
168
|
+
*
|
|
169
|
+
* Excel: `SINH(...)`.
|
|
170
|
+
*
|
|
171
|
+
* @hidden
|
|
172
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
173
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
174
|
+
*/
|
|
175
|
+
MathTrigFormulas.prototype.ComputeSINH = function () {
|
|
176
|
+
var args = [];
|
|
177
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
178
|
+
args[_i] = arguments[_i];
|
|
179
|
+
}
|
|
180
|
+
return this.unaryMath(args, Math.sinh);
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Returns the hyperbolic cosine of a number.
|
|
184
|
+
*
|
|
185
|
+
* Excel: `COSH(...)`.
|
|
186
|
+
*
|
|
187
|
+
* @hidden
|
|
188
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
189
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
190
|
+
*/
|
|
191
|
+
MathTrigFormulas.prototype.ComputeCOSH = function () {
|
|
192
|
+
var args = [];
|
|
193
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
194
|
+
args[_i] = arguments[_i];
|
|
195
|
+
}
|
|
196
|
+
return this.unaryMath(args, Math.cosh);
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Returns the hyperbolic tangent of a number.
|
|
200
|
+
*
|
|
201
|
+
* Excel: `TANH(...)`.
|
|
202
|
+
*
|
|
203
|
+
* @hidden
|
|
204
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
205
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
206
|
+
*/
|
|
207
|
+
MathTrigFormulas.prototype.ComputeTANH = function () {
|
|
208
|
+
var args = [];
|
|
209
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
210
|
+
args[_i] = arguments[_i];
|
|
211
|
+
}
|
|
212
|
+
return this.unaryMath(args, Math.tanh);
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Returns the base-10 logarithm of a number.
|
|
216
|
+
*
|
|
217
|
+
* Excel: `LOG10(...)`.
|
|
218
|
+
*
|
|
219
|
+
* @hidden
|
|
220
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
221
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
222
|
+
*/
|
|
223
|
+
MathTrigFormulas.prototype.ComputeLOG10 = function () {
|
|
224
|
+
var args = [];
|
|
225
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
226
|
+
args[_i] = arguments[_i];
|
|
227
|
+
}
|
|
228
|
+
return this.unaryMath(args, Math.log10, function (n) { return n > 0; });
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Returns the square root of a number multiplied by pi.
|
|
232
|
+
*
|
|
233
|
+
* Excel: `SQRTPI(...)`.
|
|
234
|
+
*
|
|
235
|
+
* @hidden
|
|
236
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
237
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
238
|
+
*/
|
|
239
|
+
MathTrigFormulas.prototype.ComputeSQRTPI = function () {
|
|
240
|
+
var args = [];
|
|
241
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
242
|
+
args[_i] = arguments[_i];
|
|
243
|
+
}
|
|
244
|
+
return this.unaryMath(args, function (n) { return Math.sqrt(n * Math.PI); }, function (n) { return n >= 0; });
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Returns the arctangent from x- and y-coordinates.
|
|
248
|
+
*
|
|
249
|
+
* Excel: `ATAN2(...)`.
|
|
250
|
+
*
|
|
251
|
+
* @hidden
|
|
252
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
253
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
254
|
+
*/
|
|
255
|
+
MathTrigFormulas.prototype.ComputeATAN2 = function () {
|
|
256
|
+
var args = [];
|
|
257
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
258
|
+
args[_i] = arguments[_i];
|
|
259
|
+
}
|
|
260
|
+
var errCollection = this.parent.getErrorStrings();
|
|
261
|
+
if (isNullOrUndefined(args) || args.length !== 2) {
|
|
262
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
263
|
+
}
|
|
264
|
+
var x = this.resolveNumberArg(args[0]);
|
|
265
|
+
var y = this.resolveNumberArg(args[1]);
|
|
266
|
+
if (typeof x === 'string') {
|
|
267
|
+
return x;
|
|
268
|
+
}
|
|
269
|
+
if (typeof y === 'string') {
|
|
270
|
+
return y;
|
|
271
|
+
}
|
|
272
|
+
if (x === 0 && y === 0) {
|
|
273
|
+
return errCollection[CommonErrors.DivZero];
|
|
274
|
+
}
|
|
275
|
+
// Excel ATAN2(x_num, y_num) is atan2(y, x) in JS terms (x first).
|
|
276
|
+
return Math.atan2(y, x).toString();
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Returns the sign of a number.
|
|
280
|
+
*
|
|
281
|
+
* Excel: `SIGN(...)`.
|
|
282
|
+
*
|
|
283
|
+
* @hidden
|
|
284
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
285
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
286
|
+
*/
|
|
287
|
+
MathTrigFormulas.prototype.ComputeSIGN = function () {
|
|
288
|
+
var args = [];
|
|
289
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
290
|
+
args[_i] = arguments[_i];
|
|
291
|
+
}
|
|
292
|
+
if (isNullOrUndefined(args) || args.length !== 1) {
|
|
293
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
294
|
+
}
|
|
295
|
+
var num = this.resolveNumberArg(args[0]);
|
|
296
|
+
if (typeof num === 'string') {
|
|
297
|
+
return num;
|
|
298
|
+
}
|
|
299
|
+
return (num > 0 ? 1 : num < 0 ? -1 : 0).toString();
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* Returns the integer portion of a division.
|
|
303
|
+
*
|
|
304
|
+
* Excel: `QUOTIENT(...)`.
|
|
305
|
+
*
|
|
306
|
+
* @hidden
|
|
307
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
308
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
309
|
+
*/
|
|
310
|
+
MathTrigFormulas.prototype.ComputeQUOTIENT = function () {
|
|
311
|
+
var args = [];
|
|
312
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
313
|
+
args[_i] = arguments[_i];
|
|
314
|
+
}
|
|
315
|
+
var errCollection = this.parent.getErrorStrings();
|
|
316
|
+
if (isNullOrUndefined(args) || args.length !== 2) {
|
|
317
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
318
|
+
}
|
|
319
|
+
var numerator = this.resolveNumberArg(args[0]);
|
|
320
|
+
var denominator = this.resolveNumberArg(args[1]);
|
|
321
|
+
if (typeof numerator === 'string') {
|
|
322
|
+
return numerator;
|
|
323
|
+
}
|
|
324
|
+
if (typeof denominator === 'string') {
|
|
325
|
+
return denominator;
|
|
326
|
+
}
|
|
327
|
+
if (denominator === 0) {
|
|
328
|
+
return errCollection[CommonErrors.DivZero];
|
|
329
|
+
}
|
|
330
|
+
return Math.trunc(numerator / denominator).toString();
|
|
331
|
+
};
|
|
332
|
+
return MathTrigFormulas;
|
|
333
|
+
}(FormulaModuleBase));
|
|
334
|
+
export { MathTrigFormulas };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FormulaModuleBase } from './formula-module-base';
|
|
2
|
+
/**
|
|
3
|
+
* Shared matrix helpers for MDETERM / MINVERSE / MMULT / TRANSPOSE.
|
|
4
|
+
*
|
|
5
|
+
* @hidden
|
|
6
|
+
*/
|
|
7
|
+
export declare class MatrixFormulaBase extends FormulaModuleBase {
|
|
8
|
+
protected readMatrix(ref: string): number[][] | string;
|
|
9
|
+
protected flattenMatrix(matrix: number[][], transpose?: boolean): string;
|
|
10
|
+
protected determinant(m: number[][]): number;
|
|
11
|
+
protected inverse(m: number[][]): number[][] | null;
|
|
12
|
+
protected multiply(a: number[][], b: number[][]): number[][] | null;
|
|
13
|
+
}
|