mathjs 12.2.1 → 12.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +8 -0
- package/NOTICE +1 -1
- package/README.md +4 -3
- package/bin/cli.js +1 -1
- package/lib/browser/math.js +1 -1
- package/lib/browser/math.js.LICENSE.txt +3 -3
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/expression/node/AccessorNode.js +4 -5
- package/lib/cjs/expression/node/ArrayNode.js +4 -5
- package/lib/cjs/expression/node/AssignmentNode.js +4 -5
- package/lib/cjs/expression/node/BlockNode.js +4 -5
- package/lib/cjs/expression/node/ConditionalNode.js +4 -5
- package/lib/cjs/expression/node/ConstantNode.js +4 -5
- package/lib/cjs/expression/node/FunctionAssignmentNode.js +4 -5
- package/lib/cjs/expression/node/FunctionNode.js +5 -6
- package/lib/cjs/expression/node/IndexNode.js +4 -5
- package/lib/cjs/expression/node/ObjectNode.js +4 -5
- package/lib/cjs/expression/node/OperatorNode.js +4 -5
- package/lib/cjs/expression/node/ParenthesisNode.js +4 -5
- package/lib/cjs/expression/node/RangeNode.js +4 -5
- package/lib/cjs/expression/node/RelationalNode.js +4 -5
- package/lib/cjs/expression/node/SymbolNode.js +4 -5
- package/lib/cjs/header.js +3 -3
- package/lib/cjs/type/unit/Unit.js +86 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/header.js +1 -1
- package/lib/esm/type/unit/Unit.js +86 -2
- package/lib/esm/version.js +1 -1
- package/package.json +12 -12
package/lib/cjs/header.js
CHANGED
@@ -6,11 +6,11 @@
|
|
6
6
|
* It features real and complex numbers, units, matrices, a large set of
|
7
7
|
* mathematical functions, and a flexible expression parser.
|
8
8
|
*
|
9
|
-
* @version 12.
|
10
|
-
* @date
|
9
|
+
* @version 12.3.0
|
10
|
+
* @date 2024-01-12
|
11
11
|
*
|
12
12
|
* @license
|
13
|
-
* Copyright (C) 2013-
|
13
|
+
* Copyright (C) 2013-2024 Jos de Jong <wjosdejong@gmail.com>
|
14
14
|
*
|
15
15
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
16
16
|
* use this file except in compliance with the License. You may obtain a copy
|
@@ -743,7 +743,7 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
|
|
743
743
|
Unit.prototype.abs = function () {
|
744
744
|
var ret = this.clone();
|
745
745
|
if (ret.value !== null) {
|
746
|
-
if (ret._isDerived() || ret.units[0].unit.offset === 0) {
|
746
|
+
if (ret._isDerived() || ret.units.length === 0 || ret.units[0].unit.offset === 0) {
|
747
747
|
ret.value = abs(ret.value);
|
748
748
|
} else {
|
749
749
|
// To give the correct, but unexpected, results for units with an offset.
|
@@ -786,7 +786,7 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
|
|
786
786
|
if (other.value !== null) {
|
787
787
|
throw new Error('Cannot convert to a unit with a value');
|
788
788
|
}
|
789
|
-
if (this.value === null || this._isDerived() || this.units[0].unit.offset === other.units[0].unit.offset) {
|
789
|
+
if (this.value === null || this._isDerived() || this.units.length === 0 || other.units.length === 0 || this.units[0].unit.offset === other.units[0].unit.offset) {
|
790
790
|
other.value = (0, _object.clone)(value);
|
791
791
|
} else {
|
792
792
|
/* Need to adjust value by difference in offset to convert */
|
@@ -974,6 +974,10 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
|
|
974
974
|
ret.units = proposedUnitList;
|
975
975
|
ret.fixPrefix = true;
|
976
976
|
ret.skipAutomaticSimplification = true;
|
977
|
+
if (this.value !== null) {
|
978
|
+
ret.value = null;
|
979
|
+
return this.to(ret);
|
980
|
+
}
|
977
981
|
return ret;
|
978
982
|
};
|
979
983
|
|
@@ -1254,6 +1258,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
|
|
1254
1258
|
value: 1e24,
|
1255
1259
|
scientific: true
|
1256
1260
|
},
|
1261
|
+
R: {
|
1262
|
+
name: 'R',
|
1263
|
+
value: 1e27,
|
1264
|
+
scientific: true
|
1265
|
+
},
|
1266
|
+
Q: {
|
1267
|
+
name: 'Q',
|
1268
|
+
value: 1e30,
|
1269
|
+
scientific: true
|
1270
|
+
},
|
1257
1271
|
d: {
|
1258
1272
|
name: 'd',
|
1259
1273
|
value: 1e-1,
|
@@ -1303,6 +1317,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
|
|
1303
1317
|
name: 'y',
|
1304
1318
|
value: 1e-24,
|
1305
1319
|
scientific: true
|
1320
|
+
},
|
1321
|
+
r: {
|
1322
|
+
name: 'r',
|
1323
|
+
value: 1e-27,
|
1324
|
+
scientific: true
|
1325
|
+
},
|
1326
|
+
q: {
|
1327
|
+
name: 'q',
|
1328
|
+
value: 1e-30,
|
1329
|
+
scientific: true
|
1306
1330
|
}
|
1307
1331
|
},
|
1308
1332
|
LONG: {
|
@@ -1361,6 +1385,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
|
|
1361
1385
|
value: 1e24,
|
1362
1386
|
scientific: true
|
1363
1387
|
},
|
1388
|
+
ronna: {
|
1389
|
+
name: 'ronna',
|
1390
|
+
value: 1e27,
|
1391
|
+
scientific: true
|
1392
|
+
},
|
1393
|
+
quetta: {
|
1394
|
+
name: 'quetta',
|
1395
|
+
value: 1e30,
|
1396
|
+
scientific: true
|
1397
|
+
},
|
1364
1398
|
deci: {
|
1365
1399
|
name: 'deci',
|
1366
1400
|
value: 1e-1,
|
@@ -1410,6 +1444,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
|
|
1410
1444
|
name: 'yocto',
|
1411
1445
|
value: 1e-24,
|
1412
1446
|
scientific: true
|
1447
|
+
},
|
1448
|
+
ronto: {
|
1449
|
+
name: 'ronto',
|
1450
|
+
value: 1e-27,
|
1451
|
+
scientific: true
|
1452
|
+
},
|
1453
|
+
quecto: {
|
1454
|
+
name: 'quecto',
|
1455
|
+
value: 1e-30,
|
1456
|
+
scientific: true
|
1413
1457
|
}
|
1414
1458
|
},
|
1415
1459
|
SQUARED: {
|
@@ -1468,6 +1512,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
|
|
1468
1512
|
value: 1e48,
|
1469
1513
|
scientific: true
|
1470
1514
|
},
|
1515
|
+
R: {
|
1516
|
+
name: 'R',
|
1517
|
+
value: 1e54,
|
1518
|
+
scientific: true
|
1519
|
+
},
|
1520
|
+
Q: {
|
1521
|
+
name: 'Q',
|
1522
|
+
value: 1e60,
|
1523
|
+
scientific: true
|
1524
|
+
},
|
1471
1525
|
d: {
|
1472
1526
|
name: 'd',
|
1473
1527
|
value: 1e-2,
|
@@ -1517,6 +1571,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
|
|
1517
1571
|
name: 'y',
|
1518
1572
|
value: 1e-48,
|
1519
1573
|
scientific: true
|
1574
|
+
},
|
1575
|
+
r: {
|
1576
|
+
name: 'r',
|
1577
|
+
value: 1e-54,
|
1578
|
+
scientific: true
|
1579
|
+
},
|
1580
|
+
q: {
|
1581
|
+
name: 'q',
|
1582
|
+
value: 1e-60,
|
1583
|
+
scientific: true
|
1520
1584
|
}
|
1521
1585
|
},
|
1522
1586
|
CUBIC: {
|
@@ -1575,6 +1639,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
|
|
1575
1639
|
value: 1e72,
|
1576
1640
|
scientific: true
|
1577
1641
|
},
|
1642
|
+
R: {
|
1643
|
+
name: 'R',
|
1644
|
+
value: 1e81,
|
1645
|
+
scientific: true
|
1646
|
+
},
|
1647
|
+
Q: {
|
1648
|
+
name: 'Q',
|
1649
|
+
value: 1e90,
|
1650
|
+
scientific: true
|
1651
|
+
},
|
1578
1652
|
d: {
|
1579
1653
|
name: 'd',
|
1580
1654
|
value: 1e-3,
|
@@ -1624,6 +1698,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
|
|
1624
1698
|
name: 'y',
|
1625
1699
|
value: 1e-72,
|
1626
1700
|
scientific: true
|
1701
|
+
},
|
1702
|
+
r: {
|
1703
|
+
name: 'r',
|
1704
|
+
value: 1e-81,
|
1705
|
+
scientific: true
|
1706
|
+
},
|
1707
|
+
q: {
|
1708
|
+
name: 'q',
|
1709
|
+
value: 1e-90,
|
1710
|
+
scientific: true
|
1627
1711
|
}
|
1628
1712
|
},
|
1629
1713
|
BINARY_SHORT_SI: {
|
package/lib/cjs/version.js
CHANGED
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.version = void 0;
|
7
|
-
var version = exports.version = '12.
|
7
|
+
var version = exports.version = '12.3.0';
|
8
8
|
// Note: This file is automatically generated when building math.js.
|
9
9
|
// Changes made in this file will be overwritten.
|
package/lib/esm/header.js
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
* @date @@date
|
11
11
|
*
|
12
12
|
* @license
|
13
|
-
* Copyright (C) 2013-
|
13
|
+
* Copyright (C) 2013-2024 Jos de Jong <wjosdejong@gmail.com>
|
14
14
|
*
|
15
15
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
16
16
|
* use this file except in compliance with the License. You may obtain a copy
|
@@ -731,7 +731,7 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
731
731
|
Unit.prototype.abs = function () {
|
732
732
|
var ret = this.clone();
|
733
733
|
if (ret.value !== null) {
|
734
|
-
if (ret._isDerived() || ret.units[0].unit.offset === 0) {
|
734
|
+
if (ret._isDerived() || ret.units.length === 0 || ret.units[0].unit.offset === 0) {
|
735
735
|
ret.value = abs(ret.value);
|
736
736
|
} else {
|
737
737
|
// To give the correct, but unexpected, results for units with an offset.
|
@@ -774,7 +774,7 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
774
774
|
if (other.value !== null) {
|
775
775
|
throw new Error('Cannot convert to a unit with a value');
|
776
776
|
}
|
777
|
-
if (this.value === null || this._isDerived() || this.units[0].unit.offset === other.units[0].unit.offset) {
|
777
|
+
if (this.value === null || this._isDerived() || this.units.length === 0 || other.units.length === 0 || this.units[0].unit.offset === other.units[0].unit.offset) {
|
778
778
|
other.value = clone(value);
|
779
779
|
} else {
|
780
780
|
/* Need to adjust value by difference in offset to convert */
|
@@ -962,6 +962,10 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
962
962
|
ret.units = proposedUnitList;
|
963
963
|
ret.fixPrefix = true;
|
964
964
|
ret.skipAutomaticSimplification = true;
|
965
|
+
if (this.value !== null) {
|
966
|
+
ret.value = null;
|
967
|
+
return this.to(ret);
|
968
|
+
}
|
965
969
|
return ret;
|
966
970
|
};
|
967
971
|
|
@@ -1242,6 +1246,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
1242
1246
|
value: 1e24,
|
1243
1247
|
scientific: true
|
1244
1248
|
},
|
1249
|
+
R: {
|
1250
|
+
name: 'R',
|
1251
|
+
value: 1e27,
|
1252
|
+
scientific: true
|
1253
|
+
},
|
1254
|
+
Q: {
|
1255
|
+
name: 'Q',
|
1256
|
+
value: 1e30,
|
1257
|
+
scientific: true
|
1258
|
+
},
|
1245
1259
|
d: {
|
1246
1260
|
name: 'd',
|
1247
1261
|
value: 1e-1,
|
@@ -1291,6 +1305,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
1291
1305
|
name: 'y',
|
1292
1306
|
value: 1e-24,
|
1293
1307
|
scientific: true
|
1308
|
+
},
|
1309
|
+
r: {
|
1310
|
+
name: 'r',
|
1311
|
+
value: 1e-27,
|
1312
|
+
scientific: true
|
1313
|
+
},
|
1314
|
+
q: {
|
1315
|
+
name: 'q',
|
1316
|
+
value: 1e-30,
|
1317
|
+
scientific: true
|
1294
1318
|
}
|
1295
1319
|
},
|
1296
1320
|
LONG: {
|
@@ -1349,6 +1373,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
1349
1373
|
value: 1e24,
|
1350
1374
|
scientific: true
|
1351
1375
|
},
|
1376
|
+
ronna: {
|
1377
|
+
name: 'ronna',
|
1378
|
+
value: 1e27,
|
1379
|
+
scientific: true
|
1380
|
+
},
|
1381
|
+
quetta: {
|
1382
|
+
name: 'quetta',
|
1383
|
+
value: 1e30,
|
1384
|
+
scientific: true
|
1385
|
+
},
|
1352
1386
|
deci: {
|
1353
1387
|
name: 'deci',
|
1354
1388
|
value: 1e-1,
|
@@ -1398,6 +1432,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
1398
1432
|
name: 'yocto',
|
1399
1433
|
value: 1e-24,
|
1400
1434
|
scientific: true
|
1435
|
+
},
|
1436
|
+
ronto: {
|
1437
|
+
name: 'ronto',
|
1438
|
+
value: 1e-27,
|
1439
|
+
scientific: true
|
1440
|
+
},
|
1441
|
+
quecto: {
|
1442
|
+
name: 'quecto',
|
1443
|
+
value: 1e-30,
|
1444
|
+
scientific: true
|
1401
1445
|
}
|
1402
1446
|
},
|
1403
1447
|
SQUARED: {
|
@@ -1456,6 +1500,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
1456
1500
|
value: 1e48,
|
1457
1501
|
scientific: true
|
1458
1502
|
},
|
1503
|
+
R: {
|
1504
|
+
name: 'R',
|
1505
|
+
value: 1e54,
|
1506
|
+
scientific: true
|
1507
|
+
},
|
1508
|
+
Q: {
|
1509
|
+
name: 'Q',
|
1510
|
+
value: 1e60,
|
1511
|
+
scientific: true
|
1512
|
+
},
|
1459
1513
|
d: {
|
1460
1514
|
name: 'd',
|
1461
1515
|
value: 1e-2,
|
@@ -1505,6 +1559,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
1505
1559
|
name: 'y',
|
1506
1560
|
value: 1e-48,
|
1507
1561
|
scientific: true
|
1562
|
+
},
|
1563
|
+
r: {
|
1564
|
+
name: 'r',
|
1565
|
+
value: 1e-54,
|
1566
|
+
scientific: true
|
1567
|
+
},
|
1568
|
+
q: {
|
1569
|
+
name: 'q',
|
1570
|
+
value: 1e-60,
|
1571
|
+
scientific: true
|
1508
1572
|
}
|
1509
1573
|
},
|
1510
1574
|
CUBIC: {
|
@@ -1563,6 +1627,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
1563
1627
|
value: 1e72,
|
1564
1628
|
scientific: true
|
1565
1629
|
},
|
1630
|
+
R: {
|
1631
|
+
name: 'R',
|
1632
|
+
value: 1e81,
|
1633
|
+
scientific: true
|
1634
|
+
},
|
1635
|
+
Q: {
|
1636
|
+
name: 'Q',
|
1637
|
+
value: 1e90,
|
1638
|
+
scientific: true
|
1639
|
+
},
|
1566
1640
|
d: {
|
1567
1641
|
name: 'd',
|
1568
1642
|
value: 1e-3,
|
@@ -1612,6 +1686,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
1612
1686
|
name: 'y',
|
1613
1687
|
value: 1e-72,
|
1614
1688
|
scientific: true
|
1689
|
+
},
|
1690
|
+
r: {
|
1691
|
+
name: 'r',
|
1692
|
+
value: 1e-81,
|
1693
|
+
scientific: true
|
1694
|
+
},
|
1695
|
+
q: {
|
1696
|
+
name: 'q',
|
1697
|
+
value: 1e-90,
|
1698
|
+
scientific: true
|
1615
1699
|
}
|
1616
1700
|
},
|
1617
1701
|
BINARY_SHORT_SI: {
|
package/lib/esm/version.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mathjs",
|
3
|
-
"version": "12.
|
3
|
+
"version": "12.3.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",
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"unit"
|
26
26
|
],
|
27
27
|
"dependencies": {
|
28
|
-
"@babel/runtime": "^7.23.
|
28
|
+
"@babel/runtime": "^7.23.8",
|
29
29
|
"complex.js": "^2.1.1",
|
30
30
|
"decimal.js": "^10.4.3",
|
31
31
|
"escape-latex": "^1.2.0",
|
@@ -36,21 +36,21 @@
|
|
36
36
|
"typed-function": "^4.1.1"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@babel/core": "7.23.
|
39
|
+
"@babel/core": "7.23.7",
|
40
40
|
"@babel/plugin-transform-object-assign": "7.23.3",
|
41
|
-
"@babel/plugin-transform-runtime": "7.23.
|
42
|
-
"@babel/preset-env": "7.23.
|
43
|
-
"@babel/register": "7.
|
41
|
+
"@babel/plugin-transform-runtime": "7.23.7",
|
42
|
+
"@babel/preset-env": "7.23.8",
|
43
|
+
"@babel/register": "7.23.7",
|
44
44
|
"@types/assert": "1.5.10",
|
45
45
|
"@types/mocha": "10.0.6",
|
46
|
-
"@typescript-eslint/eslint-plugin": "6.
|
47
|
-
"@typescript-eslint/parser": "6.
|
46
|
+
"@typescript-eslint/eslint-plugin": "6.18.1",
|
47
|
+
"@typescript-eslint/parser": "6.18.1",
|
48
48
|
"assert": "2.1.0",
|
49
49
|
"babel-loader": "9.1.3",
|
50
50
|
"benchmark": "2.1.4",
|
51
|
-
"c8": "
|
51
|
+
"c8": "9.0.0",
|
52
52
|
"codecov": "3.8.3",
|
53
|
-
"core-js": "3.
|
53
|
+
"core-js": "3.35.0",
|
54
54
|
"del": "6.1.1",
|
55
55
|
"dtslint": "4.2.1",
|
56
56
|
"eslint": "8.56.0",
|
@@ -58,8 +58,8 @@
|
|
58
58
|
"eslint-config-standard": "17.1.0",
|
59
59
|
"eslint-plugin-import": "2.29.1",
|
60
60
|
"eslint-plugin-mocha": "10.2.0",
|
61
|
-
"eslint-plugin-n": "16.
|
62
|
-
"eslint-plugin-prettier": "5.1.
|
61
|
+
"eslint-plugin-n": "16.6.2",
|
62
|
+
"eslint-plugin-prettier": "5.1.3",
|
63
63
|
"eslint-plugin-promise": "6.1.1",
|
64
64
|
"expect-type": "0.17.3",
|
65
65
|
"expr-eval": "2.0.2",
|