mathjs 14.4.0 → 14.5.0
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/HISTORY.md +11 -0
- package/README.md +1 -1
- package/lib/browser/math.js +1 -1
- package/lib/browser/math.js.LICENSE.txt +2 -2
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/constants.js +12 -12
- package/lib/cjs/core/create.js +1 -2
- package/lib/cjs/defaultInstance.js +1 -2
- package/lib/cjs/entry/allFactoriesAny.js +1 -2
- package/lib/cjs/entry/allFactoriesNumber.js +1 -2
- package/lib/cjs/expression/embeddedDocs/construction/index.js +1 -1
- package/lib/cjs/expression/embeddedDocs/embeddedDocs.js +6 -0
- package/lib/cjs/expression/embeddedDocs/function/expression/compile.js +14 -0
- package/lib/cjs/expression/embeddedDocs/function/expression/evaluate.js +1 -1
- package/lib/cjs/expression/embeddedDocs/function/expression/parse.js +14 -0
- package/lib/cjs/expression/embeddedDocs/function/expression/parser.js +14 -0
- package/lib/cjs/expression/embeddedDocs/function/statistics/sum.js +1 -1
- package/lib/cjs/expression/function/parser.js +1 -1
- package/lib/cjs/expression/parse.js +3 -2
- package/lib/cjs/function/arithmetic/add.js +33 -33
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/type/matrix/DenseMatrix.js +127 -91
- package/lib/cjs/type/unit/Unit.js +19 -4
- package/lib/cjs/utils/snapshot.js +1 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/constants.js +12 -12
- package/lib/esm/expression/embeddedDocs/construction/index.js +1 -1
- package/lib/esm/expression/embeddedDocs/embeddedDocs.js +6 -0
- package/lib/esm/expression/embeddedDocs/function/expression/compile.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/expression/evaluate.js +1 -1
- package/lib/esm/expression/embeddedDocs/function/expression/parse.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/expression/parser.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/statistics/sum.js +1 -1
- package/lib/esm/expression/function/parser.js +1 -1
- package/lib/esm/expression/parse.js +3 -2
- package/lib/esm/function/arithmetic/add.js +33 -33
- package/lib/esm/type/matrix/DenseMatrix.js +133 -97
- package/lib/esm/type/unit/Unit.js +19 -4
- package/lib/esm/version.js +1 -1
- package/package.json +17 -17
@@ -618,8 +618,8 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
618
618
|
|
619
619
|
// If at least one operand has a value, then the result should also have a value
|
620
620
|
if (this.value !== null || other.value !== null) {
|
621
|
-
var valThis = this.value === null ? this._normalize(
|
622
|
-
var valOther = other.value === null ? other._normalize(
|
621
|
+
var valThis = this.value === null ? this._normalize(one(other.value)) : this.value;
|
622
|
+
var valOther = other.value === null ? other._normalize(one(this.value)) : other.value;
|
623
623
|
res.value = multiplyScalar(valThis, valOther);
|
624
624
|
} else {
|
625
625
|
res.value = null;
|
@@ -666,8 +666,8 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
666
666
|
|
667
667
|
// If at least one operand has a value, the result should have a value
|
668
668
|
if (this.value !== null || other.value !== null) {
|
669
|
-
var valThis = this.value === null ? this._normalize(
|
670
|
-
var valOther = other.value === null ? other._normalize(
|
669
|
+
var valThis = this.value === null ? this._normalize(one(other.value)) : this.value;
|
670
|
+
var valOther = other.value === null ? other._normalize(one(this.value)) : other.value;
|
671
671
|
res.value = divideScalar(valThis, valOther);
|
672
672
|
} else {
|
673
673
|
res.value = null;
|
@@ -723,6 +723,21 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
723
723
|
}
|
724
724
|
}
|
725
725
|
|
726
|
+
/**
|
727
|
+
* Create a value one with the numeric type of `typeOfValue`.
|
728
|
+
* For example, `one(new BigNumber(3))` returns `BigNumber(1)`
|
729
|
+
* @param {number | Fraction | BigNumber} typeOfValue
|
730
|
+
* @returns {number | Fraction | BigNumber}
|
731
|
+
*/
|
732
|
+
function one(typeOfValue) {
|
733
|
+
// TODO: this is a workaround to prevent the following BigNumber conversion error from throwing:
|
734
|
+
// "TypeError: Cannot implicitly convert a number with >15 significant digits to BigNumber"
|
735
|
+
// see https://github.com/josdejong/mathjs/issues/3450
|
736
|
+
// https://github.com/josdejong/mathjs/pull/3375
|
737
|
+
var convert = Unit._getNumberConverter(typeOf(typeOfValue));
|
738
|
+
return convert(1);
|
739
|
+
}
|
740
|
+
|
726
741
|
/**
|
727
742
|
* Calculate the absolute value of a unit
|
728
743
|
* @memberof Unit
|
package/lib/esm/version.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mathjs",
|
3
|
-
"version": "14.
|
3
|
+
"version": "14.5.0",
|
4
4
|
"description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.",
|
5
5
|
"author": "Jos de Jong <wjosdejong@gmail.com> (https://github.com/josdejong)",
|
6
6
|
"homepage": "https://mathjs.org",
|
@@ -36,21 +36,21 @@
|
|
36
36
|
"typed-function": "^4.2.1"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@babel/core": "7.
|
40
|
-
"@babel/plugin-transform-object-assign": "7.
|
41
|
-
"@babel/plugin-transform-optional-catch-binding": "7.
|
42
|
-
"@babel/plugin-transform-runtime": "7.
|
43
|
-
"@babel/preset-env": "7.
|
44
|
-
"@babel/register": "7.
|
39
|
+
"@babel/core": "7.27.1",
|
40
|
+
"@babel/plugin-transform-object-assign": "7.27.1",
|
41
|
+
"@babel/plugin-transform-optional-catch-binding": "7.27.1",
|
42
|
+
"@babel/plugin-transform-runtime": "7.27.1",
|
43
|
+
"@babel/preset-env": "7.27.2",
|
44
|
+
"@babel/register": "7.27.1",
|
45
45
|
"@types/assert": "1.5.11",
|
46
46
|
"@types/mocha": "10.0.10",
|
47
|
-
"@typescript-eslint/eslint-plugin": "8.
|
48
|
-
"@typescript-eslint/parser": "8.
|
47
|
+
"@typescript-eslint/eslint-plugin": "8.32.1",
|
48
|
+
"@typescript-eslint/parser": "8.32.1",
|
49
49
|
"assert": "2.1.0",
|
50
50
|
"babel-loader": "10.0.0",
|
51
51
|
"c8": "10.1.3",
|
52
52
|
"codecov": "3.8.3",
|
53
|
-
"core-js": "3.
|
53
|
+
"core-js": "3.42.0",
|
54
54
|
"del": "8.0.0",
|
55
55
|
"dtslint": "4.2.1",
|
56
56
|
"eigen": "0.2.2",
|
@@ -60,12 +60,12 @@
|
|
60
60
|
"eslint-plugin-import": "2.31.0",
|
61
61
|
"eslint-plugin-mocha": "10.5.0",
|
62
62
|
"eslint-plugin-n": "16.6.2",
|
63
|
-
"eslint-plugin-prettier": "5.
|
63
|
+
"eslint-plugin-prettier": "5.4.0",
|
64
64
|
"eslint-plugin-promise": "6.6.0",
|
65
|
-
"expect-type": "1.2.
|
65
|
+
"expect-type": "1.2.1",
|
66
66
|
"expr-eval": "2.0.2",
|
67
67
|
"fancy-log": "2.0.0",
|
68
|
-
"glob": "11.0.
|
68
|
+
"glob": "11.0.2",
|
69
69
|
"gulp": "5.0.0",
|
70
70
|
"gulp-babel": "8.0.0",
|
71
71
|
"handlebars": "4.7.8",
|
@@ -78,7 +78,7 @@
|
|
78
78
|
"karma-webdriver-launcher": "1.0.8",
|
79
79
|
"karma-webpack": "5.0.1",
|
80
80
|
"mkdirp": "3.0.1",
|
81
|
-
"mocha": "11.
|
81
|
+
"mocha": "11.4.0",
|
82
82
|
"mocha-junit-reporter": "2.2.1",
|
83
83
|
"ndarray": "1.0.19",
|
84
84
|
"ndarray-determinant": "1.0.0",
|
@@ -88,12 +88,12 @@
|
|
88
88
|
"numericjs": "1.2.6",
|
89
89
|
"prettier": "3.5.3",
|
90
90
|
"process": "0.11.10",
|
91
|
-
"sinon": "
|
91
|
+
"sinon": "20.0.0",
|
92
92
|
"sylvester": "0.0.21",
|
93
93
|
"tinybench": "4.0.1",
|
94
94
|
"ts-node": "10.9.2",
|
95
|
-
"typescript": "5.8.
|
96
|
-
"webpack": "5.
|
95
|
+
"typescript": "5.8.3",
|
96
|
+
"webpack": "5.99.9",
|
97
97
|
"zeros": "1.0.0"
|
98
98
|
},
|
99
99
|
"type": "module",
|