powiaina_num.js 0.2.0-alpha.3 → 0.2.0-alpha.3.2
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/README.md +1 -1
- package/dist/PowiainaNum.cjs.js +208 -25
- package/dist/PowiainaNum.esm.js +208 -25
- package/dist/PowiainaNum.js +208 -25
- package/dist/PowiainaNum.min.js +1 -1
- package/dist/index.d.ts +116 -5
- package/package.json +1 -1
package/dist/PowiainaNum.js
CHANGED
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.PowiainaNum = factory());
|
|
5
5
|
})(this, (function () { 'use strict';
|
|
6
6
|
|
|
7
|
+
function _arrayLikeToArray(r, a) {
|
|
8
|
+
(null == a || a > r.length) && (a = r.length);
|
|
9
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
10
|
+
return n;
|
|
11
|
+
}
|
|
12
|
+
function _arrayWithoutHoles(r) {
|
|
13
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
14
|
+
}
|
|
7
15
|
function _classCallCheck(a, n) {
|
|
8
16
|
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
9
17
|
}
|
|
@@ -18,6 +26,15 @@
|
|
|
18
26
|
writable: !1
|
|
19
27
|
}), e;
|
|
20
28
|
}
|
|
29
|
+
function _iterableToArray(r) {
|
|
30
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
31
|
+
}
|
|
32
|
+
function _nonIterableSpread() {
|
|
33
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
34
|
+
}
|
|
35
|
+
function _toConsumableArray(r) {
|
|
36
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
37
|
+
}
|
|
21
38
|
function _toPrimitive(t, r) {
|
|
22
39
|
if ("object" != typeof t || !t) return t;
|
|
23
40
|
var e = t[Symbol.toPrimitive];
|
|
@@ -41,6 +58,13 @@
|
|
|
41
58
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
42
59
|
}, _typeof(o);
|
|
43
60
|
}
|
|
61
|
+
function _unsupportedIterableToArray(r, a) {
|
|
62
|
+
if (r) {
|
|
63
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
64
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
65
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
44
68
|
|
|
45
69
|
var powiainaNumError = "[PowiainaNum 0.2 error]";
|
|
46
70
|
var MSI = 9007199254740991;
|
|
@@ -232,6 +256,10 @@
|
|
|
232
256
|
throw Error("Iteration failed to converge: ".concat(z.toString())); //return Decimal.dNaN;
|
|
233
257
|
}
|
|
234
258
|
var PowiainaNum = /*#__PURE__*/function () {
|
|
259
|
+
/**
|
|
260
|
+
* Constructor of PowiainaNum class,
|
|
261
|
+
* If no arguments, return `PowiainaNum.NaN`.
|
|
262
|
+
*/
|
|
235
263
|
function PowiainaNum(arg1) {
|
|
236
264
|
_classCallCheck(this, PowiainaNum);
|
|
237
265
|
this.array = [{
|
|
@@ -368,7 +396,11 @@
|
|
|
368
396
|
}
|
|
369
397
|
}, {
|
|
370
398
|
key: "pow10",
|
|
371
|
-
value:
|
|
399
|
+
value:
|
|
400
|
+
/**
|
|
401
|
+
* @returns 10 to the power of `this`
|
|
402
|
+
*/
|
|
403
|
+
function pow10() {
|
|
372
404
|
var _a, _b;
|
|
373
405
|
var r = this.clone();
|
|
374
406
|
// inf & nan check
|
|
@@ -698,7 +730,7 @@
|
|
|
698
730
|
} else if (principal) {
|
|
699
731
|
if (this.abs().lt("1e-300")) return new PowiainaNum(this);else if (this.small) {
|
|
700
732
|
return PowiainaNum.fromNumber(f_lambertw(this.toNumber()));
|
|
701
|
-
} else if (this.
|
|
733
|
+
} else if (this.lt(MSI)) {
|
|
702
734
|
return PowiainaNum.fromNumber(f_lambertw(this.sign * this.getOperator(0)));
|
|
703
735
|
} else if (this.lt("eee15")) {
|
|
704
736
|
return d_lambertw(this);
|
|
@@ -806,29 +838,51 @@
|
|
|
806
838
|
value: function chain(other, arrows) {
|
|
807
839
|
return this.arrow(arrows)(other);
|
|
808
840
|
}
|
|
841
|
+
/**
|
|
842
|
+
* Select the largest number of arguments.
|
|
843
|
+
*/
|
|
809
844
|
}, {
|
|
810
845
|
key: "max",
|
|
811
|
-
value: function max(
|
|
812
|
-
var
|
|
813
|
-
|
|
846
|
+
value: function max() {
|
|
847
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
848
|
+
args[_key2] = arguments[_key2];
|
|
849
|
+
}
|
|
850
|
+
return PowiainaNum.max.apply(PowiainaNum, [this].concat(args));
|
|
814
851
|
}
|
|
815
852
|
}, {
|
|
816
853
|
key: "min",
|
|
817
|
-
value: function min(
|
|
818
|
-
var
|
|
819
|
-
|
|
854
|
+
value: function min() {
|
|
855
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
856
|
+
args[_key3] = arguments[_key3];
|
|
857
|
+
}
|
|
858
|
+
return PowiainaNum.min.apply(PowiainaNum, [this].concat(args));
|
|
820
859
|
}
|
|
860
|
+
/**
|
|
861
|
+
* Compare what PowiainaNum's absolute value is max
|
|
862
|
+
* @param args
|
|
863
|
+
* @returns absolute value max number's absolute value
|
|
864
|
+
*/
|
|
821
865
|
}, {
|
|
822
866
|
key: "maxabs",
|
|
823
|
-
value: function maxabs(
|
|
824
|
-
var
|
|
825
|
-
|
|
867
|
+
value: function maxabs() {
|
|
868
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
869
|
+
args[_key4] = arguments[_key4];
|
|
870
|
+
}
|
|
871
|
+
var other = args.map(function (x) {
|
|
872
|
+
return new PowiainaNum(x).abs();
|
|
873
|
+
});
|
|
874
|
+
return PowiainaNum.max.apply(PowiainaNum, [this.abs()].concat(_toConsumableArray(other)));
|
|
826
875
|
}
|
|
827
876
|
}, {
|
|
828
877
|
key: "minabs",
|
|
829
|
-
value: function minabs(
|
|
830
|
-
var
|
|
831
|
-
|
|
878
|
+
value: function minabs() {
|
|
879
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
880
|
+
args[_key5] = arguments[_key5];
|
|
881
|
+
}
|
|
882
|
+
var other = args.map(function (x) {
|
|
883
|
+
return new PowiainaNum(x).abs();
|
|
884
|
+
});
|
|
885
|
+
return PowiainaNum.min.apply(PowiainaNum, [this.abs()].concat(_toConsumableArray(other)));
|
|
832
886
|
}
|
|
833
887
|
}, {
|
|
834
888
|
key: "cmpabs",
|
|
@@ -1124,7 +1178,7 @@
|
|
|
1124
1178
|
this.setOperator(Math.pow(10, this.getOperator(0)), 0);
|
|
1125
1179
|
renormalize = true;
|
|
1126
1180
|
}
|
|
1127
|
-
if (this.getOperator(0) > MSI) {
|
|
1181
|
+
if (this.getOperator(0) > MSI && !isFinite(this.getOperator(0))) {
|
|
1128
1182
|
this.setOperator(this.getOperator(1) + 1, 1);
|
|
1129
1183
|
this.setOperator(Math.log10(this.getOperator(0)), 0);
|
|
1130
1184
|
renormalize = true;
|
|
@@ -1309,7 +1363,7 @@
|
|
|
1309
1363
|
key: "arr01",
|
|
1310
1364
|
get:
|
|
1311
1365
|
/**
|
|
1312
|
-
* A property
|
|
1366
|
+
* A property array value for version 0.1.x PowiainaNum.
|
|
1313
1367
|
*/
|
|
1314
1368
|
function get() {
|
|
1315
1369
|
var res = [0];
|
|
@@ -1443,6 +1497,64 @@
|
|
|
1443
1497
|
// 2--3, 1e10-<e1e10, 10^10^10^0->1
|
|
1444
1498
|
return PowiainaNum.NaN.clone();*/
|
|
1445
1499
|
}
|
|
1500
|
+
}, {
|
|
1501
|
+
key: "max",
|
|
1502
|
+
value: function max() {
|
|
1503
|
+
var max = PowiainaNum.NEGATIVE_INFINITY;
|
|
1504
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
1505
|
+
args[_key6] = arguments[_key6];
|
|
1506
|
+
}
|
|
1507
|
+
for (var i = 0; i < args.length; i++) {
|
|
1508
|
+
if (max.lt(args[i])) {
|
|
1509
|
+
max = new PowiainaNum(args[i]).clone();
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
return max;
|
|
1513
|
+
}
|
|
1514
|
+
/**
|
|
1515
|
+
* Select the smallest number of arguments.
|
|
1516
|
+
*/
|
|
1517
|
+
}, {
|
|
1518
|
+
key: "min",
|
|
1519
|
+
value: function min() {
|
|
1520
|
+
var max = PowiainaNum.POSITIVE_INFINITY;
|
|
1521
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
1522
|
+
args[_key7] = arguments[_key7];
|
|
1523
|
+
}
|
|
1524
|
+
for (var i = 0; i < args.length; i++) {
|
|
1525
|
+
if (max.gt(args[i])) {
|
|
1526
|
+
max = new PowiainaNum(args[i]).clone();
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
return max;
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* Restrict a number be not lower than a number
|
|
1533
|
+
*
|
|
1534
|
+
* It's also an alias of `PowiainaNum.max`.
|
|
1535
|
+
* @returns restricted number
|
|
1536
|
+
*/
|
|
1537
|
+
}, {
|
|
1538
|
+
key: "clampMin",
|
|
1539
|
+
value: function clampMin() {
|
|
1540
|
+
return PowiainaNum.max.apply(PowiainaNum, arguments);
|
|
1541
|
+
}
|
|
1542
|
+
/**
|
|
1543
|
+
* Restrict a number be not higher than a number
|
|
1544
|
+
*
|
|
1545
|
+
* It's also an alias of `PowiainaNum.min`.
|
|
1546
|
+
* @returns restricted number
|
|
1547
|
+
*/
|
|
1548
|
+
}, {
|
|
1549
|
+
key: "clampMax",
|
|
1550
|
+
value: function clampMax() {
|
|
1551
|
+
return PowiainaNum.min.apply(PowiainaNum, arguments);
|
|
1552
|
+
}
|
|
1553
|
+
}, {
|
|
1554
|
+
key: "sign",
|
|
1555
|
+
value: function sign(a) {
|
|
1556
|
+
return new PowiainaNum(a).sign;
|
|
1557
|
+
}
|
|
1446
1558
|
}, {
|
|
1447
1559
|
key: "isNaN",
|
|
1448
1560
|
value: function isNaN(x) {
|
|
@@ -1710,6 +1822,9 @@
|
|
|
1710
1822
|
}
|
|
1711
1823
|
}]);
|
|
1712
1824
|
}();
|
|
1825
|
+
/**
|
|
1826
|
+
* Zero
|
|
1827
|
+
*/
|
|
1713
1828
|
PowiainaNum.ZERO = new PowiainaNum({
|
|
1714
1829
|
array: [{
|
|
1715
1830
|
arrow: 0,
|
|
@@ -1721,6 +1836,9 @@
|
|
|
1721
1836
|
layer: 0,
|
|
1722
1837
|
sign: 0
|
|
1723
1838
|
});
|
|
1839
|
+
/**
|
|
1840
|
+
* One
|
|
1841
|
+
*/
|
|
1724
1842
|
PowiainaNum.ONE = new PowiainaNum({
|
|
1725
1843
|
array: [{
|
|
1726
1844
|
arrow: 0,
|
|
@@ -1732,12 +1850,22 @@
|
|
|
1732
1850
|
layer: 0,
|
|
1733
1851
|
sign: 1
|
|
1734
1852
|
});
|
|
1853
|
+
/**
|
|
1854
|
+
* The value of the largest integer n such that n and n + 1 are both
|
|
1855
|
+
* exactly representable as a Number value = 9007199254740991 = 2^53 − 1.
|
|
1856
|
+
*/
|
|
1735
1857
|
PowiainaNum.MSI = new PowiainaNum(MSI);
|
|
1858
|
+
/**
|
|
1859
|
+
* MSI's reciprocate value, = 1/9007199254740991.
|
|
1860
|
+
*/
|
|
1736
1861
|
PowiainaNum.MSI_REC = function () {
|
|
1737
1862
|
var obj = new PowiainaNum(MSI);
|
|
1738
1863
|
obj.small = true;
|
|
1739
1864
|
return obj;
|
|
1740
1865
|
}();
|
|
1866
|
+
/**
|
|
1867
|
+
* 10^(MSI) = 10^9007199254740991.
|
|
1868
|
+
*/
|
|
1741
1869
|
PowiainaNum.E_MSI = new PowiainaNum({
|
|
1742
1870
|
array: [{
|
|
1743
1871
|
arrow: 0,
|
|
@@ -1754,6 +1882,9 @@
|
|
|
1754
1882
|
layer: 0,
|
|
1755
1883
|
sign: 1
|
|
1756
1884
|
});
|
|
1885
|
+
/**
|
|
1886
|
+
* 10^(MSI) 's reciprocate value, = 10^-9007199254740991.
|
|
1887
|
+
*/
|
|
1757
1888
|
PowiainaNum.E_MSI_REC = new PowiainaNum({
|
|
1758
1889
|
array: [{
|
|
1759
1890
|
arrow: 0,
|
|
@@ -1770,51 +1901,69 @@
|
|
|
1770
1901
|
layer: 0,
|
|
1771
1902
|
sign: 1
|
|
1772
1903
|
});
|
|
1904
|
+
/**
|
|
1905
|
+
* Tetrated MSI, = 10↑↑9007199254740991.
|
|
1906
|
+
*/
|
|
1773
1907
|
PowiainaNum.TETRATED_MSI = new PowiainaNum({
|
|
1774
1908
|
array: [{
|
|
1775
1909
|
arrow: 0,
|
|
1776
1910
|
expans: 1,
|
|
1777
1911
|
megota: 1,
|
|
1778
|
-
repeat:
|
|
1912
|
+
repeat: 1e10
|
|
1779
1913
|
}, {
|
|
1780
1914
|
arrow: 1,
|
|
1781
1915
|
expans: 1,
|
|
1782
1916
|
megota: 1,
|
|
1783
|
-
repeat: MSI
|
|
1917
|
+
repeat: MSI - 2
|
|
1784
1918
|
}],
|
|
1785
1919
|
small: false,
|
|
1786
1920
|
layer: 0,
|
|
1787
1921
|
sign: 1
|
|
1788
1922
|
});
|
|
1923
|
+
/**
|
|
1924
|
+
* Pentated MSI, = 10↑↑↑9007199254740991.
|
|
1925
|
+
*/
|
|
1789
1926
|
PowiainaNum.PENTATED_MSI = new PowiainaNum({
|
|
1790
1927
|
array: [{
|
|
1791
1928
|
arrow: 0,
|
|
1792
1929
|
expans: 1,
|
|
1793
1930
|
megota: 1,
|
|
1794
|
-
repeat:
|
|
1795
|
-
}, {
|
|
1796
|
-
arrow: 1,
|
|
1797
|
-
expans: 1,
|
|
1798
|
-
megota: 1,
|
|
1799
|
-
repeat: MSI
|
|
1931
|
+
repeat: 10
|
|
1800
1932
|
}, {
|
|
1801
1933
|
arrow: 2,
|
|
1802
1934
|
expans: 1,
|
|
1803
1935
|
megota: 1,
|
|
1804
|
-
repeat: MSI
|
|
1936
|
+
repeat: MSI - 1
|
|
1805
1937
|
}],
|
|
1806
1938
|
small: false,
|
|
1807
1939
|
layer: 0,
|
|
1808
1940
|
sign: 1
|
|
1809
1941
|
});
|
|
1942
|
+
/**
|
|
1943
|
+
* Tritri, = 3↑↑↑3 = power tower with height 7625597484987 base 3.
|
|
1944
|
+
*/
|
|
1810
1945
|
PowiainaNum.TRITRI = new PowiainaNum({
|
|
1811
1946
|
small: false,
|
|
1812
1947
|
layer: 0,
|
|
1813
1948
|
sign: 1,
|
|
1814
1949
|
array: [newOperator(3638334640023.7783, 0, 1, 1), newOperator(7625587484984, 1, 1, 1)]
|
|
1815
1950
|
});
|
|
1951
|
+
/**
|
|
1952
|
+
* The Graham's Number, = G^64(4)
|
|
1953
|
+
*
|
|
1954
|
+
* = 3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{
|
|
1955
|
+
* 3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3{3↑↑↑↑3
|
|
1956
|
+
* }3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3
|
|
1957
|
+
* }3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3}3
|
|
1958
|
+
*/
|
|
1816
1959
|
PowiainaNum.GRAHAMS_NUMBER = new PowiainaNum("(10{!})^63 10^^^(10^)^7625597484984 3638334640023.7783");
|
|
1960
|
+
/**
|
|
1961
|
+
* Positive Infinity.
|
|
1962
|
+
*/
|
|
1817
1963
|
PowiainaNum.POSITIVE_INFINITY = new PowiainaNum(Infinity);
|
|
1964
|
+
/**
|
|
1965
|
+
* Negative Infinity.
|
|
1966
|
+
*/
|
|
1818
1967
|
PowiainaNum.NEGATIVE_INFINITY = new PowiainaNum(-Infinity);
|
|
1819
1968
|
PowiainaNum.NaN = new PowiainaNum({
|
|
1820
1969
|
array: [{
|
|
@@ -1827,6 +1976,40 @@
|
|
|
1827
1976
|
layer: 0,
|
|
1828
1977
|
sign: 0
|
|
1829
1978
|
});
|
|
1979
|
+
/**
|
|
1980
|
+
* The mathematical constant e. This is Euler's number, the base of natural logarithms.
|
|
1981
|
+
*/
|
|
1982
|
+
PowiainaNum.E = new PowiainaNum(Math.E);
|
|
1983
|
+
/**
|
|
1984
|
+
* The natural logarithm of 2 = ln(2).
|
|
1985
|
+
*/
|
|
1986
|
+
PowiainaNum.LN2 = new PowiainaNum(Math.LN2);
|
|
1987
|
+
/**
|
|
1988
|
+
* The natural logarithm of 10.
|
|
1989
|
+
*/
|
|
1990
|
+
PowiainaNum.LN10 = new PowiainaNum(Math.LN10);
|
|
1991
|
+
/**
|
|
1992
|
+
* The base-2 logarithm of e = log_2(e).
|
|
1993
|
+
*/
|
|
1994
|
+
PowiainaNum.LOG2E = new PowiainaNum(Math.LOG2E);
|
|
1995
|
+
/**
|
|
1996
|
+
* The base-10 logarithm of e = log_10(e).
|
|
1997
|
+
*/
|
|
1998
|
+
PowiainaNum.LOG10E = new PowiainaNum(Math.LOG10E);
|
|
1999
|
+
/**
|
|
2000
|
+
* Pi(). This is the ratio of the circumference of a circle to its diameter.
|
|
2001
|
+
*/
|
|
2002
|
+
PowiainaNum.PI = new PowiainaNum(Math.PI);
|
|
2003
|
+
/**
|
|
2004
|
+
* The square root of 0.5, or, equivalently, one divided by the square root of 2.
|
|
2005
|
+
*
|
|
2006
|
+
* = (√2)/2 = √(0.5)
|
|
2007
|
+
*/
|
|
2008
|
+
PowiainaNum.SQRT1_2 = new PowiainaNum(Math.SQRT1_2);
|
|
2009
|
+
/**
|
|
2010
|
+
* The square root of 2 = √2.
|
|
2011
|
+
*/
|
|
2012
|
+
PowiainaNum.SQRT2 = new PowiainaNum(Math.SQRT2);
|
|
1830
2013
|
PowiainaNum.maxOps = 100;
|
|
1831
2014
|
PowiainaNum.arrowFuncMap = new Map();
|
|
1832
2015
|
|
package/dist/PowiainaNum.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r="undefined"!=typeof globalThis?globalThis:r||self).PowiainaNum=e()}(this,(function(){"use strict";function r(r,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,e(n.key),n)}}function e(r){var e=function(r,e){if("object"!=typeof r||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var a=t.call(r,e||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==typeof e?e:e+""}function t(r){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(r)}var a=9007199254740991,n=15.954589770191003,i=1.444667861009766,o=/^(PN)?\/*[-\+]*(Infinity|NaN|(10(\^+|\{([1-9]\d*|!)(,([1-9]\d*|!))?(,[1-9]\d*)?\})|\(10(\^+|\{([1-9]\d*|!)(,([1-9]\d*|!))?(,[1-9]\d*)?\})\)\^[1-9]\d*\x20*)*((\d+(\.\d*)?|\d*\.\d+)?([Ee][-\+]*))*(0|\d+(\.\d*)?|\d*\.\d+))$/;function s(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return{repeat:r,arrow:e,expans:t,megota:a,valuereplaced:e==1/0?0:t==1/0?1:-1}}function l(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];for(var a=0;a<Math.min(e[0].length,e[1].length);a++){var n=e[0][a],i=e[1][a];if(n<i)return-1;if(n>i)return 1}return 0}function u(r){return Math.log10(Number(r.substring(0,17)))+(r.length-17)}var h=.5671432904097838;function g(r){var e,t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e-10,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!Number.isFinite(r))return r;if(n){if(0===r)return r;if(1===r)return h;e=r<10?0:Math.log(r)-Math.log(Math.log(r))}else{if(0===r)return-1/0;e=r<=-.1?-2:Math.log(-r)-Math.log(-Math.log(-r))}for(var i=0;i<100;++i){if(t=(r*Math.exp(-e)+e*e)/(e+1),Math.abs(t-e)<a*Math.abs(t))return t;e=t}throw Error("Iteration failed to converge: ".concat(r.toString()))}function f(r){return 2==r.length}function c(r){return"number"==typeof r[0]&&"number"==typeof r[1]}function y(r){var e,t,a,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e-10,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(r.isInfiNaN())return r;if(o){if(r.eq(m.ZERO))return m.ZERO.clone();if(r.eq(m.ONE))return m.fromNumber(h);e=r.log()}else{if(r.eq(m.ZERO))return m.NEGATIVE_INFINITY.clone();e=r.neg().log()}for(var s=0;s<100;++s){if(t=e.neg().exp(),a=e.sub(r.mul(t)),(n=e.sub(a.div(e.add(1).sub(e.add(2).mul(a).div(e.mul(2).add(2)))))).sub(e).abs().lt(n.abs().mul(i)))return n;e=n}throw Error("Iteration failed to converge: ".concat(r.toString()))}var p,m=function(){function e(r){if(function(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.array=[{arrow:0,expans:1,megota:1,repeat:NaN}],this.small=!1,this.sign=0,this.layer=0,void 0===r);else if("number"==typeof r){var a=e.fromNumber(r);this.resetFromObject(a)}else if("object"==t(r)){var n=e.fromObject(r);this.resetFromObject(n)}else if("string"==typeof r){var i=e.fromString(r);this.resetFromObject(i)}}return function(e,t,a){return t&&r(e.prototype,t),a&&r(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,[{key:"add",value:function(r){var t,i,o,l,u,h,g=this.clone(),f=new e(r);if(g.eq(e.POSITIVE_INFINITY)&&f.eq(e.NEGATIVE_INFINITY)||g.eq(e.NEGATIVE_INFINITY)&&f.eq(e.POSITIVE_INFINITY))return e.NaN.clone();if(!g.isFinite())return g.clone();if(!f.isFinite())return f.clone();if(g.isZero())return f.clone();if(f.isZero())return g.clone();if(g.sign==-f.sign&&function(){var r=g.abs(),e=f.abs();return r.eq(e)}())return e.ZERO.clone();if(g.abs().lt(a)&&f.abs().lt(a))return e.fromNumber(g.toNumber()+f.toNumber());if(g.abs().lt(e.E_MSI_REC)||g.abs().gt(e.E_MSI)||f.abs().lt(e.E_MSI_REC)||f.abs().gt(e.E_MSI))return g.maxabs(f);if(-1==g.sign)return g.neg().add(f.neg()).neg();g.cmpabs(f)>0?(u=g,h=f):(h=g,u=f);var c=1;if(!(u.small||h.small||(null===(t=u.array[1])||void 0===t?void 0:t.repeat)||(null===(i=h.array[1])||void 0===i?void 0:i.repeat)||u.sign!=h.sign))return new e((u.array[0].repeat+h.array[0].repeat)*u.sign);var y=(u.small?-1:1)*((null===(o=u.array[1])||void 0===o?void 0:o.repeat)?u.array[0].repeat:Math.log10(u.array[0].repeat)),p=(h.small?-1:1)*((null===(l=h.array[1])||void 0===l?void 0:l.repeat)?h.array[0].repeat:Math.log10(h.array[0].repeat));if(y-p>n)return u;var m,v,N=-Math.floor(y),w=0;if((v=u.sign*Math.pow(10,y+N)+h.sign*Math.pow(10,p+N))>0&&(w=Math.log10(v)-N),v<0&&(w=Math.log10(-v)-N,c*=-1),0==v)throw Error("Encounter a calculate error");return(m=new e).sign=1,m.array=w>n||w<-n?[s(w,0),s(1,1)]:[s(Math.pow(10,Math.abs(w)),0)],m.small=w<0,m.sign*=c,m}},{key:"sub",value:function(r){return this.add(new e(r).neg())}},{key:"mul",value:function(r){var t,a=this.clone(),n=new e(r);return a.eq(e.POSITIVE_INFINITY)&&n.eq(e.NEGATIVE_INFINITY)||n.eq(e.POSITIVE_INFINITY)&&a.eq(e.NEGATIVE_INFINITY)?e.NEGATIVE_INFINITY.clone():a.isInfiNaN()&&n.eq(e.ZERO)&&n.isInfiNaN()&&a.eq(e.ZERO)?e.NaN.clone():a.eq(e.NEGATIVE_INFINITY)&&n.eq(e.NEGATIVE_INFINITY)?e.POSITIVE_INFINITY.clone():a.isFinite()?n.isFinite()?a.isZero()||n.isZero()?e.ZERO.clone():((t=a.abs().log10().add(n.abs().log10()).pow10()).sign=a.sign*n.sign,t):n.clone():a.clone()}},{key:"div",value:function(r){var t=new e(r).rec();return this.mul(t)}},{key:"pow10",value:function(){var r,t,a=this.clone();return this.isFinite()?a.isneg()?(a.sign*=-1,a.pow10().rec()):a.lte(308.25471555991675)?e.fromNumber(Math.pow(10,a.toNumber())):a.small?a.lt(e.MSI_REC)?e.ONE:new e(Math.pow(10,Math.pow(a.array[0].repeat,-1))):(a.gt(e.TETRATED_MSI)||(a.setOperator((null!==(t=null===(r=a.array[1])||void 0===r?void 0:r.repeat)&&void 0!==t?t:0)+1,1),a.normalize()),a):this.clone()}},{key:"pow",value:function(r){var t=new e(r);if(!t.isFinite())return t.clone();if(!this.isFinite())return this.clone();if(this.eq(10))return t.pow10();if(this.isneg()){if(!t.isInt())return e.NaN.clone();var a=this.abs().pow(t);return a.sign=function(){var r=t.mod(2).round();return r.eq(0)||r.eq(2)?1:-1}(),a}var n=this.toNumber(),i=t.toNumber(),o=Math.pow(n,i);return isFinite(o)?e.fromNumber(o):this.log10().mul(t).pow10()}},{key:"pow_base",value:function(r){return new e(r).pow(this)}},{key:"root",value:function(r){var t=new e(r);return this.pow(t.rec())}},{key:"sqrt",value:function(){return this.pow(.5)}},{key:"cbrt",value:function(){return this.root(3)}},{key:"tetrate",value:function(r){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=this.clone(),s=new e(r),l=new e(n);if(o.isNaN()||s.isNaN()||l.isNaN())return e.NaN.clone();if(l.neq(e.ONE)&&(s=s.add(l.slog(o))),s.isInfi()&&s.sign>0)return o.gte(i)?e.POSITIVE_INFINITY.clone():(t=this.log().neg()).lambertw().div(t);if(s.lte(-2))return e.NaN.clone();if(o.isZero())return s.isZero()?e.NaN.clone():s.gte(a/2)||s.toNumber()%2==0?e.ZERO.clone():e.ONE.clone();if(o.eq(e.ONE))return s.eq(e.ONE.neg())?e.NaN.clone():e.ONE.clone();if(s.eq(e.ONE.neg()))return e.ZERO.clone();if(s.eq(e.ZERO))return e.ONE.clone();if(s.eq(e.ONE))return o;if(s.eq(2))return o.pow(o);if(o.eq(2)){if(s.eq(3))return e.fromNumber(16);if(s.eq(4))return e.fromNumber(65536)}var u=o.max(s);if(u.gt(e.PENTATED_MSI))return u;if(u.gt(e.TETRATED_MSI)||s.gt(a)){if(this.lt(i))return(t=o.ln().neg()).lambertw().div(t);var h=o.slog(10).add(s);return h.setOperator(h.getOperator(2)+1,2),h.normalize(),h}for(var g=s.toNumber(),f=Math.floor(g),c=o.pow(g-f),y=e.NaN,p=0,m=e.E_MSI.clone();0!==f&&c.lt(m)&&p<100;++p)if(f>0){if(c=o.pow(c),y.eq(c)){f=0;break}y=c,--f}else{if(c=c.log(o),y.eq(c)){f=0;break}y=c,++f}return(100==p||this.lt(i))&&(f=0),c.setOperator(c.getOperator(1)+f,1),c.normalize(),c}},{key:"slog",value:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=this.clone(),a=new e(r);if(t.isInfiNaN())return t;if(a.isNaN())return a;if(a.isInfi())return e.ZERO.clone();if(t.isZero())return e.ONE.clone();if(t.eq(e.ONE))return e.ZERO.clone();if(t.eq(a))return e.ONE.clone();if(a.lt(i)){var n=a.tetrate(1/0);if(t.eq(n))return e.POSITIVE_INFINITY.clone();if(t.gt(n))return e.NaN.clone()}if(t.max(a).gt(e.PENTATED_MSI))return t.gt(a)?t:e.ZERO.clone();if(t.max(a).gt(e.TETRATED_MSI)&&t.gt(a))return t.setOperator(t.getOperator(2)-1,2),t.normalize(),t.sub(t.getOperator(1));if(t.lt(e.ZERO.clone()))return a.pow(t).sub(2);var o=0,s=t.getOperator(1)-a.getOperator(1);if(s>3){var l=s-3;o+=l,t.setOperator(t.getOperator(1)-l,1)}for(var u=0;u<100;++u){if(t.lte(e.ONE))return new e(o+t.toNumber());++o,t=e.log(t,r)}return console.warn("Failed to converage"),e.NaN.clone()}},{key:"abs",value:function(){var r=this.clone();return r.sign<0&&(r.sign*=-1),r}},{key:"log10",value:function(){if(this.isneg())return e.NaN.clone();if(this.isZero())return e.NEGATIVE_INFINITY.clone();if(this.small){var r=this.clone();return r.small=!r.small,r.log10().neg()}if(1==this.array.length)return new e(Math.log10(this.array[0].repeat));if(this.gte(e.TETRATED_MSI))return this.clone();var t=this.clone();return t.array[1].repeat=t.array[1].repeat-1,t.normalize(),t}},{key:"log",value:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Math.E,t=new e(r);return this.log10().div(t.log10())}},{key:"ln",value:function(){return this.log()}},{key:"exp",value:function(){return this.pow_base(Math.E)}},{key:"mod",value:function(r){var t=new e(r),a=this.div(t);return a.sub(a.floor()).mul(t)}},{key:"factorial",value:function(){return this.abs().lt(a)?this.add(1).gamma():this.abs().lt(e.E_MSI)?e.exp(this.mul(this.log10().sub(1))):e.exp(this)}},{key:"gamma",value:function(){if(this.small)return this.rec();if(this.lte(a)){if(this.lt(24))return e.fromNumber(function(r){if(!isFinite(r))return r;if(r<-50)return r===Math.trunc(r)?Number.NEGATIVE_INFINITY:0;for(var e=1;r<10;)e*=r,++r;var t=.9189385332046727;t+=((r-=1)+.5)*Math.log(r),t-=r;var a=r*r,n=r;return t+=1/(12*n),t-=1/(360*(n*=a)),t+=1/(1260*(n*=a)),t-=1/(1680*(n*=a)),t+=1/(1188*(n*=a)),t-=691/(360360*(n*=a)),t+=7/(1092*(n*=a)),t-=3617/(122400*(n*=a)),Math.exp(t)/e}(this.sign*this.getOperator(0)));var r=this.getOperator(0)-1,t=.9189385332046727;t+=(r+.5)*Math.log(r);var n=r*r,i=r,o=12*i,s=1/o,l=(t-=r)+s;if(l===t)return e.exp(t);if((l=(t=l)-(s=1/(o=360*(i*=n))))===t)return e.exp(t);t=l;var u=1/(o=1260*(i*=n));return t+=u,t-=u=1/(o=1680*(i*=n)),e.exp(t)}return this.gt(a)?e.exp(this.mul(this.log().sub(1))):e.exp(this)}},{key:"lambertw",value:function(){var r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.lt(-.3678794411710499)?e.NaN.clone():r?this.abs().lt("1e-300")?new e(this):this.small?e.fromNumber(g(this.toNumber())):0===this.layer?e.fromNumber(g(this.sign*this.getOperator(0))):this.lt("eee15")?y(this):this.log():1===this.sign?e.NaN.clone():0===this.layer?e.fromNumber(g(this.sign*this.array[0].repeat,1e-10,!1)):1==this.layer?y(this,1e-10,!1):this.neg().rec().lambertw().neg()}},{key:"arrow",value:function(r){var t=this.clone(),n=new e(r);return!n.isInt()||n.lt(e.ZERO)?(console.warn("The arrow is <0 or not a integer, the returned function will return NaN."),function(){return e.NaN.clone()}):n.eq(0)?function(r){return t.mul(r)}:n.eq(1)?function(r){return t.pow(r)}:n.eq(2)?function(r){return t.tetrate(r)}:function(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=new e(r),s=e.arrowFuncMap.get("".concat(t.toString()," ").concat(n.toString()," ").concat(o.toString()));if(s)return s.clone();var l=function(){var r;if(t.isNaN()||o.isNaN())return e.NaN.clone();if(o.lt(e.ZERO))return e.NaN.clone();if(t.eq(e.ZERO))return o.eq(e.ONE)?e.ZERO.clone():e.NaN.clone();if(t.eq(e.ONE))return e.ONE.clone();if(o.eq(e.ZERO))return e.ONE.clone();if(o.eq(e.ONE))return t.clone();if(n.gt(e.MSI))return(r=n.clone()).setOperator(r.getOperator(1/0)+1,1/0),r;var s=n.toNumber();if(o.eq(2))return t.arrow(s-1)(t,i+1);if(t.max(o).gt(e.arrowMSI(s+1)))return t.max(o);if(t.gt(e.arrowMSI(s))||o.gt(a)){t.gt(e.arrowMSI(s))?((r=t.clone()).setOperator(r.getOperator(s)-1,s),r.normalize()):r=t.gt(e.arrowMSI(s-1))?new e(t.getOperator(s-1)):e.ZERO;var l=r.add(o);return l.setOperator(l.getOperator(s)+1,s),l.normalize(),l}if(i>=e.maxOps+10)return new e([[0,10],[s,1]]);var u=o.toNumber(),h=Math.floor(u),g=n.sub(e.ONE);r=t.arrow(g)(u-h,i+1);for(var f=0,c=e.arrowMSI(s-1);0!==h&&r.lt(c)&&f<100;f++)h>0&&(r=t.arrow(g)(r,i+1),--h);return 100==f&&(h=0),r.setOperator(r.getOperator(s-1)+h,s-1),r.normalize(),r}();return e.arrowFuncMap.set("".concat(t.toString()," ").concat(n.toString()," ").concat(o.toString()),l.clone()),l}}},{key:"chain",value:function(r,e){return this.arrow(e)(r)}},{key:"max",value:function(r){var t=new e(r);return this.lt(t)?t.clone():this.clone()}},{key:"min",value:function(r){var t=new e(r);return this.gte(t)?t.clone():this.clone()}},{key:"maxabs",value:function(r){var t=new e(r).abs();return this.abs().lt(t)?t.clone():this.clone()}},{key:"minabs",value:function(r){var t=new e(r).abs();return this.abs().gt(t)?t.clone():this.clone()}},{key:"cmpabs",value:function(r){var t=new e(r).abs();return this.abs().cmp(t)}},{key:"neg",value:function(){var r=this.clone();return r.sign*=-1,r.normalize(),r}},{key:"rec",value:function(){var r=this.clone();return r.small=!r.small,r}},{key:"floor",value:function(){if(this.isInt())return this.clone();if(this.small)return 1==this.sign?e.ZERO.clone():e.ONE.neg().clone();var r=this.abs();return r.array[0].repeat=Math[1==this.sign?"floor":"ceil"](r.getOperator(0)),r}},{key:"ceil",value:function(){if(this.isInt())return this.clone();if(this.small)return 1==this.sign?e.ONE.clone():e.ZERO.clone();var r=this.abs();return r.array[0].repeat=Math[1==this.sign?"ceil":"floor"](r.getOperator(0)),r.sign=this.sign,r}},{key:"round",value:function(){if(this.isInt())return this.clone();if(this.small)return 1==this.sign?this.rec().lte(2)?e.ONE.clone():e.ZERO.clone():this.abs().rec().lte(2)?e.ZERO.clone():e.ONE.neg().clone();var r=this.abs();return r.array[0].repeat=Math.round(r.array[0].repeat),r.sign=this.sign,r}},{key:"trunc",value:function(){var r=this.clone();return r.gte(0)?r.floor():r.ceil()}},{key:"compare",value:function(r){var t=new e(r);if(this.isNaN()||t.isNaN())return 2;if(this.sign<t.sign)return-1;if(this.sign>t.sign)return 1;var a=-1==this.sign&&-1==t.sign;if(this.small&&!t.small)return-1*(a?-1:1);if(t.small&&!this.small)return 1*(a?-1:1);var n=1;this.small&&t.small&&(n*=-1),a&&(n*=-1);for(var i=0,o=0;this.array.length-1-o>=0&&t.array.length-1-o>=0;o++){var s=this.array[this.array.length-1-o],u=t.array[t.array.length-1-o],h=l([s.megota,s.expans,s.arrow,s.repeat],[u.megota,u.expans,u.arrow,u.repeat]);if(1==h){i=1;break}if(-1==h){i=-1;break}}return i*n+1-1}},{key:"cmp",value:function(r){return this.compare(r)}},{key:"eq",value:function(r){return 0===this.cmp(r)}},{key:"neq",value:function(r){return 0!==this.cmp(r)}},{key:"lt",value:function(r){return-1===this.cmp(r)}},{key:"lte",value:function(r){return this.cmp(r)<=0}},{key:"gt",value:function(r){return 1==this.cmp(r)}},{key:"gte",value:function(r){var e=this.cmp(r);return 0==e||1==e}},{key:"isNaN",value:function(r){function e(){return r.apply(this,arguments)}return e.toString=function(){return r.toString()},e}((function(){return isNaN(this.getOperator(0))}))},{key:"isZero",value:function(){return Boolean(this.small&&!isFinite(this.getOperator(0)))}},{key:"isFinite",value:function(r){function e(){return r.apply(this,arguments)}return e.toString=function(){return r.toString()},e}((function(){return Boolean(this.small||isFinite(this.getOperator(0)))&&!this.isNaN()}))},{key:"isInfi",value:function(){return this.rec().isZero()}},{key:"isInfiNaN",value:function(){return this.isInfi()||this.isNaN()}},{key:"isInt",value:function(){return!!this.isZero()||(!(this.small||!Number.isInteger(this.getOperator(0)))||!!this.abs().gte(a/2))}},{key:"ispos",value:function(){return this.sign>0}},{key:"isneg",value:function(){return this.sign<0}},{key:"normalize",value:function(){for(var r=!0,t=this,i=0;i<this.array.length;i++)if(this.array[i].repeat==1/0)return this.array=[{arrow:0,expans:1,megota:1,repeat:1/0}],this.layer=0,this;for(var o=1;o<t.array.length;++o){var u=t.array[o];if(null!==u.arrow&&void 0!==u.arrow||(u.arrow=0),null!==u.expans&&void 0!==u.expans||(u.expans=1),null!==u.megota&&void 0!==u.megota||(u.megota=1),isNaN(u.arrow)||isNaN(u.repeat)||isNaN(u.expans)||isNaN(u.megota))return t.array=[s(NaN,0,1,1)],t;if(!isFinite(u.repeat)||!isFinite(u.megota))return t.array=[s(1/0,0,1,1)],t;Number.isInteger(u.arrow)||(u.arrow=Math.floor(u.arrow)),Number.isInteger(u.repeat)||(u.repeat=Math.floor(u.repeat)),Number.isInteger(u.expans)||(u.expans=Math.floor(u.expans)),Number.isInteger(u.megota)||(u.megota=Math.floor(u.megota))}t.array.length||(t.small=!t.small,t.array=[s(1/0)]);do{for(r=!1,this.array.sort((function(r,e){return l([r.megota,r.expans,r.arrow],[e.megota,e.expans,e.arrow])})),o=1;o<t.array.length-1;++o)t.array[o].arrow==t.array[o+1].arrow&&t.array[o].expans==t.array[o+1].expans&&t.array[o].megota==t.array[o+1].megota&&(t.array[o].repeat+=t.array[o+1].repeat,t.array.splice(o+1,1),--o,r=!0);for(o=1;o<t.array.length;++o)0===t.array[o].arrow||0!==t.array[o].repeat&&null!==t.array[o].repeat&&void 0!==t.array[o].repeat?0==t.array[o].arrow&&t.array[o].expans>=2&&(t.array[o].arrow=1/0,t.array[o].valuereplaced=0,t.array[o].expans=t.array[o].expans-1):(t.array.splice(o,1),--o);for(t.array.length>e.maxOps&&t.array.splice(1,t.array.length-e.maxOps),this.getOperator(1)>=1&&this.getOperator(0)<n&&(this.setOperator(this.getOperator(1)-1,1),this.setOperator(Math.pow(10,this.getOperator(0)),0),r=!0),this.getOperator(0)>a&&(this.setOperator(this.getOperator(1)+1,1),this.setOperator(Math.log10(this.getOperator(0)),0),r=!0),1==this.array.length&&this.array[0].repeat<1&&(this.array[0].repeat=1/this.array[0].repeat,this.small=!this.small,r=!0);t.array.length>=2&&1==t.array[0].repeat&&t.array[1].repeat;)t.array[1].repeat>1?t.array[1].repeat--:t.array.splice(1,1),t.array[0].repeat=10,r=!0;t.array.length>=2&&t.array[0].repeat<a&&t.array[1].arrow>=2&&1==t.array[1].repeat&&isFinite(t.array[1].arrow)&&(t.array.splice(1,1,s(t.array[0].repeat,t.array[1].arrow-1,t.array[1].expans,t.array[1].megota)),t.array[0].repeat=10,r=!0),t.array.length>=2&&t.array[1].repeat>a&&(t.array[1].arrow++,t.array[0].repeat=t.array[1].repeat,t.array[1].repeat=1,r=!0)}while(r);return this}},{key:"getOperatorIndex",value:function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(1==this.array.length&&0==r)return 0;if(1==this.array.length&&1==r)return.5;if(2==this.array.length&&1==r)return 1;if(2==this.array.length&&0==r)return 0;for(var a=0;a<this.array.length;a++){var n=l([this.array[a].megota,this.array[a].expans,this.array[a].arrow],[t,e,r]);if(0==n)return a;if(1==n)return a-.5}return this.array.length-.5}},{key:"getOperator",value:function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=this.getOperatorIndex(r,e,t);return this.array[a]?this.array[a].repeat:0}},{key:"setOperator",value:function(r,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=this.getOperatorIndex(e,t,a);return this.array[n]?(this.array[n].repeat=r,!1):(this.array.splice(Math.ceil(n),0,{arrow:e,expans:t,megota:a,valuereplaced:t===1/0?1:e==1/0?0:-1,repeat:r}),!0)}},{key:"clone",value:function(){var r=new e;return r.resetFromObject(this),r}},{key:"resetFromObject",value:function(r){this.array=[];for(var e=0;e<r.array.length;e++)this.array[e]={arrow:r.array[e].arrow,expans:r.array[e].expans,megota:r.array[e].megota,repeat:r.array[e].repeat,valuereplaced:r.array[e].valuereplaced};return this.small=r.small,this.sign=r.sign,this.layer=r.layer,this}},{key:"toNumber",value:function(){return-1==this.sign?-this.neg().toNumber():this.small?1/this.rec().toNumber():this.array.length>2?1/0:1==this.array.length?this.array[0].repeat:2==this.array.length&&1==this.array[1].arrow&&1==this.array[1].expans&&1==this.array[1].megota&&1==this.array[1].repeat?Math.pow(10,this.getOperator(0)):NaN}},{key:"toString",value:function(){if(this.isNaN())return"NaN";if(-1==this.sign)return"-".concat(this.neg().toString());if(this.small)return this.isZero()?"0":"/".concat(this.rec().toString());if(this.isInfi())return"Infinity";for(var r="",e=this.array.length-1;e>=0;e--){var t=this.array[e],a="10{".concat(t.arrow===1/0?"!":t.arrow).concat(t.expans>1||t.megota>1?",".concat(t.expans===1/0?"!":t.expans):"").concat(t.megota>1?",".concat(t.megota):"","}");a=1==t.arrow&&1==t.expans&&1==t.megota&&t.repeat<5?"e".repeat(t.repeat):0==t.arrow&&1==t.expans&&1==t.megota?t.repeat.toString():t.repeat>1?"(".concat(a,")^").concat(t.repeat," "):"".concat(a),r+="".concat(a)}return r}},{key:"toJSON",value:function(){return"PN"+this.toString()}},{key:"arr01",get:function(){for(var r=[0],e=0;e<this.array.length;e++)0==e?r[0]=this.array[e].repeat:(r[e]=[0,0,0,0],r[e][0]=this.array[e].arrow==1/0?"x":this.array[e].arrow,r[e][1]=this.array[e].repeat,r[e][2]=this.array[e].expans==1/0?"x":this.array[e].expans,r[e][3]=this.array[e].megota);return r}}],[{key:"add",value:function(r,t){return new e(r).add(t)}},{key:"sub",value:function(r,t){return new e(r).sub(t)}},{key:"mul",value:function(r,t){return new e(r).mul(t)}},{key:"div",value:function(r,t){return new e(r).div(t)}},{key:"pow",value:function(r,t){return new e(r).pow(t)}},{key:"root",value:function(r,t){return new e(r).root(t)}},{key:"sqrt",value:function(r){return new e(r).sqrt()}},{key:"cbrt",value:function(r){return new e(r).cbrt()}},{key:"tetrate",value:function(r,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return new e(r).tetrate(t,a)}},{key:"log10",value:function(r){return new e(r).log10()}},{key:"log",value:function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Math.E;return new e(r).log(t)}},{key:"exp",value:function(r){return new e(r).pow_base(Math.E)}},{key:"factorial",value:function(r){return new e(r).factorial()}},{key:"gamma",value:function(r){return new e(r).gamma()}},{key:"lambertw",value:function(r){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return new e(r).lambertw(t)}},{key:"tetrate_10",value:function(r){return e.fromNumber(10).tetrate(r)}},{key:"isNaN",value:function(r){return new e(r).isNaN()}},{key:"arrowMSI",value:function(r){return new e("10".concat(r).concat(a))}},{key:"fromNumber",value:function(r){var t=new e;if(r<0)t.sign=-1;else{if(0==r)return t.sign=0,t.small=!0,t.array=[s(1/0,0)],t;r>0&&(t.sign=1)}var n=Math.abs(r);return n>=11102230246251568e-32&&n<1?(t.small=!0,t.array=[s(1/n,0)]):n<11102230246251568e-32?(t.small=!0,t.array=[s(-Math.log10(n),0),s(1,1)]):n<=a?t.array=[s(n,0)]:(t.setOperator(Math.log10(n),0),t.array=[s(Math.log10(n),0),s(1,1)]),t}},{key:"fromString",value:function(r){var t,i,l,h,g,f,c,y=new e;if(r.startsWith("PN")&&(r=r.substring(2)),!isNaN(Number(r))){var p=Number(r),m=!1;if(0==p?/^(0*\.0*e)|(0*\.0*)$/.test(r)&&(m=!0):m=!0,!m){var v=r.search(/e/),N=r.substring((-1==v?r.length:v)+1),w=r.substring(0,-1==v?void 0:v),b=[0,0];if(b[1]=Number(N||"0"),Number(w)>=1){var I=w.length>=17?u(w):Math.log10(Number(w)),d=I-(Math.floor(I)-1);b[0]=Math.pow(10,d),b[1]+=d}else{var O=(c=w.match(/^0\.(0*)[1-9]/))?c[1].length:0;w=(w=w.substring(w.search(/[1-9]/))).charAt(0)+"."+w.substring(1),O+=1,b[0]=Number(w),b[1]+=-O}return e.pow(10,-b[1]-1).mul(10*Math.pow(b[0],-1)).rec()}if(isFinite(p)&&m)return y.resetFromObject(e.fromNumber(Number(r))),y}if(r=r.replace(/\(e\^(\d+)\)/g,"(10^)^$1 ").replace(/(\d+)\x20*PT/g,"(10^)^$1 "),!o.test(r))throw"[PowiainaNum 0.2 error]malformed input: "+r;var E=!1,M=!1;if("-"==r[0]||"+"==r[0]){var k=r.search(/[^-\+]/);E=(null!==(i=null===(t=r.substring(0,k).match(/-/g))||void 0===t?void 0:t.length)&&void 0!==i?i:0)%2==1,r=r.substring(k)}if("/"==r[0]){k=r.search(/[^\/]/);M=(null!==(h=null===(l=r.substring(0,k).match(/\//g))||void 0===l?void 0:l.length)&&void 0!==h?h:0)%2==1,r=r.substring(k)}if("NaN"==r)y.array=[s(NaN)];else if("Infinity"==r)y.array=[s(1/0)];else{var x,T,S,q;for(y.sign=1,y.array=[s(0)];r&&/^(\(?10[\^\{])/.test(r);){var F,_,R;if("("==r[0]&&(r=r.substring(1)),"^"==r[2])F=x=r.substring(2).search(/[^\^]/),T=x+2;else{x=r.indexOf("}");var Z=r.substring(3,x).split(",");F=Number("!"==Z[0]?1/0:Z[0]),_=Number(null!==(g="!"==Z[1]?1/0:Z[1])&&void 0!==g?g:1),R=Number(null!==(f=Z[2])&&void 0!==f?f:1),T=x+1}")"==(r=r.substring(T))[0]?(x=r.indexOf(" "),S=Number(r.substring(2,x)),r=r.substring(x+1)):S=1,1==F&&1==_&&1==R?y.array.length>=2&&1==y.array[1].arrow?y.array[1].repeat+=S:y.array.splice(1,0,s(S,1,_,R)):2==F&&1==_&&1==R?(x=y.array.length>=2&&1==y.array[1].arrow?y.array[1].repeat:0,(T=y.array[0].repeat)>=1e10&&++x,T>=10&&++x,y.array[0].repeat=x,y.array.length>=2&&1==y.array[1].arrow&&y.array.splice(1,1),q=y.getOperatorIndex(2),Number.isInteger(q)?y.array[q].repeat+=S:y.array.splice(Math.ceil(q),0,s(S,2,_,R))):isFinite(F)?(x=y.getOperator(F-1),(T=y.getOperator(F-2))>=10&&++x,q=y.getOperatorIndex(F),y.array.splice(1,Math.ceil(q)-1),y.array[0].repeat=x,Number.isInteger(q)?y.array[1].repeat+=S:y.array.splice(1,0,s(S,F,_,R))):y.array.splice(1,0,s(S,F,_,R))}x=r.split(/[Ee]/),T=[y.array[0].repeat,0],S=1;for(var A=x.length-1;A>=0;--A){T[0]<n&&0===T[1]?T[0]=Math.pow(10,S*T[0]):-1==S?(0===T[1]?T[0]=Math.pow(10,S*T[0]):1==T[1]&&T[0]<=Math.log10(Number.MAX_VALUE)?T[0]=Math.pow(10,S*Math.pow(10,T[0])):T[0]=0,T[1]=0):T[1]++;var P=x[A].indexOf("."),V=-1==P?x[A].length:P;0===T[1]?V>=17?(T[0]=Math.log10(T[0])+u(x[A].substring(0,V)),T[1]=1):x[A]&&(T[0]*=Number(x[A])):(q=V>=17?u(x[A].substring(0,V)):x[A]?Math.log10(Number(x[A])):0,1==T[1]?T[0]+=q:2==T[1]&&T[0]<n+Math.log10(q)&&(T[0]+=Math.log10(1+Math.pow(10,Math.log10(q)-T[0])))),T[0]<n&&T[1]?(T[0]=Math.pow(10,T[0]),T[1]--):T[0]>a&&(T[0]=Math.log10(T[0]),T[1]++)}y.array[0].repeat=T[0],T[1]&&(y.array.length>=2&&1==y.array[1].arrow?y.array[1].repeat+=T[1]:y.array.splice(1,0,s(T[1],1,1,1)))}return E&&(y.sign*=-1),M&&(y.small=!y.small),y.normalize(),y.normalize(),y}},{key:"fromObject",value:function(r){var t=new e;if(t.array=[],function(r){if(!Array.isArray(r))return!1;for(var e=0;e<r.length;e++){var t=r[e];if(!Array.isArray(t))return!1;if(!f(t))return!1;if(!c(t))return!1}return!0}(r)){for(var a=0;a<r.length;a++)t.array[a]={arrow:r[a][0],expans:1,megota:1,repeat:r[a][1]};return t.small=!1,t.sign=1,t.layer=0,t.normalize(),t}for(var n=0;n<r.array.length;n++)t.array[n]={arrow:r.array[n].arrow,expans:r.array[n].expans,megota:r.array[n].megota,repeat:r.array[n].repeat,valuereplaced:r.array[n].valuereplaced};return t.small=r.small,t.sign=r.sign,t.layer=r.layer,t}}])}();return m.ZERO=new m({array:[{arrow:0,expans:1,megota:1,repeat:1/0}],small:!0,layer:0,sign:0}),m.ONE=new m({array:[{arrow:0,expans:1,megota:1,repeat:1}],small:!1,layer:0,sign:1}),m.MSI=new m(a),m.MSI_REC=((p=new m(a)).small=!0,p),m.E_MSI=new m({array:[{arrow:0,expans:1,megota:1,repeat:a},{arrow:1,expans:1,megota:1,repeat:1}],small:!1,layer:0,sign:1}),m.E_MSI_REC=new m({array:[{arrow:0,expans:1,megota:1,repeat:a},{arrow:1,expans:1,megota:1,repeat:1}],small:!0,layer:0,sign:1}),m.TETRATED_MSI=new m({array:[{arrow:0,expans:1,megota:1,repeat:a},{arrow:1,expans:1,megota:1,repeat:a}],small:!1,layer:0,sign:1}),m.PENTATED_MSI=new m({array:[{arrow:0,expans:1,megota:1,repeat:a},{arrow:1,expans:1,megota:1,repeat:a},{arrow:2,expans:1,megota:1,repeat:a}],small:!1,layer:0,sign:1}),m.TRITRI=new m({small:!1,layer:0,sign:1,array:[s(3638334640023.7783,0,1,1),s(7625587484984,1,1,1)]}),m.GRAHAMS_NUMBER=new m("(10{!})^63 10^^^(10^)^7625597484984 3638334640023.7783"),m.POSITIVE_INFINITY=new m(1/0),m.NEGATIVE_INFINITY=new m(-1/0),m.NaN=new m({array:[{arrow:0,expans:1,megota:1,repeat:NaN}],small:!1,layer:0,sign:0}),m.maxOps=100,m.arrowFuncMap=new Map,m}));
|
|
1
|
+
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r="undefined"!=typeof globalThis?globalThis:r||self).PowiainaNum=e()}(this,(function(){"use strict";function r(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,a=Array(e);t<e;t++)a[t]=r[t];return a}function e(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,a(n.key),n)}}function t(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(e)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?r(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(r){var e=function(r,e){if("object"!=typeof r||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var a=t.call(r,e||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==typeof e?e:e+""}function n(r){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(r)}var i=9007199254740991,o=15.954589770191003,s=1.444667861009766,l=/^(PN)?\/*[-\+]*(Infinity|NaN|(10(\^+|\{([1-9]\d*|!)(,([1-9]\d*|!))?(,[1-9]\d*)?\})|\(10(\^+|\{([1-9]\d*|!)(,([1-9]\d*|!))?(,[1-9]\d*)?\})\)\^[1-9]\d*\x20*)*((\d+(\.\d*)?|\d*\.\d+)?([Ee][-\+]*))*(0|\d+(\.\d*)?|\d*\.\d+))$/;function u(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return{repeat:r,arrow:e,expans:t,megota:a,valuereplaced:e==1/0?0:t==1/0?1:-1}}function h(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];for(var a=0;a<Math.min(e[0].length,e[1].length);a++){var n=e[0][a],i=e[1][a];if(n<i)return-1;if(n>i)return 1}return 0}function f(r){return Math.log10(Number(r.substring(0,17)))+(r.length-17)}var g=.5671432904097838;function c(r){var e,t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e-10,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!Number.isFinite(r))return r;if(n){if(0===r)return r;if(1===r)return g;e=r<10?0:Math.log(r)-Math.log(Math.log(r))}else{if(0===r)return-1/0;e=r<=-.1?-2:Math.log(-r)-Math.log(-Math.log(-r))}for(var i=0;i<100;++i){if(t=(r*Math.exp(-e)+e*e)/(e+1),Math.abs(t-e)<a*Math.abs(t))return t;e=t}throw Error("Iteration failed to converge: ".concat(r.toString()))}function y(r){return 2==r.length}function p(r){return"number"==typeof r[0]&&"number"==typeof r[1]}function m(r){var e,t,a,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e-10,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(r.isInfiNaN())return r;if(o){if(r.eq(N.ZERO))return N.ZERO.clone();if(r.eq(N.ONE))return N.fromNumber(g);e=r.log()}else{if(r.eq(N.ZERO))return N.NEGATIVE_INFINITY.clone();e=r.neg().log()}for(var s=0;s<100;++s){if(t=e.neg().exp(),a=e.sub(r.mul(t)),(n=e.sub(a.div(e.add(1).sub(e.add(2).mul(a).div(e.mul(2).add(2)))))).sub(e).abs().lt(n.abs().mul(i)))return n;e=n}throw Error("Iteration failed to converge: ".concat(r.toString()))}var v,N=function(){function r(e){if(function(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),this.array=[{arrow:0,expans:1,megota:1,repeat:NaN}],this.small=!1,this.sign=0,this.layer=0,void 0===e);else if("number"==typeof e){var t=r.fromNumber(e);this.resetFromObject(t)}else if("object"==n(e)){var a=r.fromObject(e);this.resetFromObject(a)}else if("string"==typeof e){var i=r.fromString(e);this.resetFromObject(i)}}return function(r,t,a){return t&&e(r.prototype,t),a&&e(r,a),Object.defineProperty(r,"prototype",{writable:!1}),r}(r,[{key:"add",value:function(e){var t,a,n,s,l,h,f=this.clone(),g=new r(e);if(f.eq(r.POSITIVE_INFINITY)&&g.eq(r.NEGATIVE_INFINITY)||f.eq(r.NEGATIVE_INFINITY)&&g.eq(r.POSITIVE_INFINITY))return r.NaN.clone();if(!f.isFinite())return f.clone();if(!g.isFinite())return g.clone();if(f.isZero())return g.clone();if(g.isZero())return f.clone();if(f.sign==-g.sign&&function(){var r=f.abs(),e=g.abs();return r.eq(e)}())return r.ZERO.clone();if(f.abs().lt(i)&&g.abs().lt(i))return r.fromNumber(f.toNumber()+g.toNumber());if(f.abs().lt(r.E_MSI_REC)||f.abs().gt(r.E_MSI)||g.abs().lt(r.E_MSI_REC)||g.abs().gt(r.E_MSI))return f.maxabs(g);if(-1==f.sign)return f.neg().add(g.neg()).neg();f.cmpabs(g)>0?(l=f,h=g):(h=f,l=g);var c=1;if(!(l.small||h.small||(null===(t=l.array[1])||void 0===t?void 0:t.repeat)||(null===(a=h.array[1])||void 0===a?void 0:a.repeat)||l.sign!=h.sign))return new r((l.array[0].repeat+h.array[0].repeat)*l.sign);var y=(l.small?-1:1)*((null===(n=l.array[1])||void 0===n?void 0:n.repeat)?l.array[0].repeat:Math.log10(l.array[0].repeat)),p=(h.small?-1:1)*((null===(s=h.array[1])||void 0===s?void 0:s.repeat)?h.array[0].repeat:Math.log10(h.array[0].repeat));if(y-p>o)return l;var m,v,N=-Math.floor(y),w=0;if((v=l.sign*Math.pow(10,y+N)+h.sign*Math.pow(10,p+N))>0&&(w=Math.log10(v)-N),v<0&&(w=Math.log10(-v)-N,c*=-1),0==v)throw Error("Encounter a calculate error");return(m=new r).sign=1,m.array=w>o||w<-o?[u(w,0),u(1,1)]:[u(Math.pow(10,Math.abs(w)),0)],m.small=w<0,m.sign*=c,m}},{key:"sub",value:function(e){return this.add(new r(e).neg())}},{key:"mul",value:function(e){var t,a=this.clone(),n=new r(e);return a.eq(r.POSITIVE_INFINITY)&&n.eq(r.NEGATIVE_INFINITY)||n.eq(r.POSITIVE_INFINITY)&&a.eq(r.NEGATIVE_INFINITY)?r.NEGATIVE_INFINITY.clone():a.isInfiNaN()&&n.eq(r.ZERO)&&n.isInfiNaN()&&a.eq(r.ZERO)?r.NaN.clone():a.eq(r.NEGATIVE_INFINITY)&&n.eq(r.NEGATIVE_INFINITY)?r.POSITIVE_INFINITY.clone():a.isFinite()?n.isFinite()?a.isZero()||n.isZero()?r.ZERO.clone():((t=a.abs().log10().add(n.abs().log10()).pow10()).sign=a.sign*n.sign,t):n.clone():a.clone()}},{key:"div",value:function(e){var t=new r(e).rec();return this.mul(t)}},{key:"pow10",value:function(){var e,t,a=this.clone();return this.isFinite()?a.isneg()?(a.sign*=-1,a.pow10().rec()):a.lte(308.25471555991675)?r.fromNumber(Math.pow(10,a.toNumber())):a.small?a.lt(r.MSI_REC)?r.ONE:new r(Math.pow(10,Math.pow(a.array[0].repeat,-1))):(a.gt(r.TETRATED_MSI)||(a.setOperator((null!==(t=null===(e=a.array[1])||void 0===e?void 0:e.repeat)&&void 0!==t?t:0)+1,1),a.normalize()),a):this.clone()}},{key:"pow",value:function(e){var t=new r(e);if(!t.isFinite())return t.clone();if(!this.isFinite())return this.clone();if(this.eq(10))return t.pow10();if(this.isneg()){if(!t.isInt())return r.NaN.clone();var a=this.abs().pow(t);return a.sign=function(){var r=t.mod(2).round();return r.eq(0)||r.eq(2)?1:-1}(),a}var n=this.toNumber(),i=t.toNumber(),o=Math.pow(n,i);return isFinite(o)?r.fromNumber(o):this.log10().mul(t).pow10()}},{key:"pow_base",value:function(e){return new r(e).pow(this)}},{key:"root",value:function(e){var t=new r(e);return this.pow(t.rec())}},{key:"sqrt",value:function(){return this.pow(.5)}},{key:"cbrt",value:function(){return this.root(3)}},{key:"tetrate",value:function(e){var t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.clone(),o=new r(e),l=new r(a);if(n.isNaN()||o.isNaN()||l.isNaN())return r.NaN.clone();if(l.neq(r.ONE)&&(o=o.add(l.slog(n))),o.isInfi()&&o.sign>0)return n.gte(s)?r.POSITIVE_INFINITY.clone():(t=this.log().neg()).lambertw().div(t);if(o.lte(-2))return r.NaN.clone();if(n.isZero())return o.isZero()?r.NaN.clone():o.gte(i/2)||o.toNumber()%2==0?r.ZERO.clone():r.ONE.clone();if(n.eq(r.ONE))return o.eq(r.ONE.neg())?r.NaN.clone():r.ONE.clone();if(o.eq(r.ONE.neg()))return r.ZERO.clone();if(o.eq(r.ZERO))return r.ONE.clone();if(o.eq(r.ONE))return n;if(o.eq(2))return n.pow(n);if(n.eq(2)){if(o.eq(3))return r.fromNumber(16);if(o.eq(4))return r.fromNumber(65536)}var u=n.max(o);if(u.gt(r.PENTATED_MSI))return u;if(u.gt(r.TETRATED_MSI)||o.gt(i)){if(this.lt(s))return(t=n.ln().neg()).lambertw().div(t);var h=n.slog(10).add(o);return h.setOperator(h.getOperator(2)+1,2),h.normalize(),h}for(var f=o.toNumber(),g=Math.floor(f),c=n.pow(f-g),y=r.NaN,p=0,m=r.E_MSI.clone();0!==g&&c.lt(m)&&p<100;++p)if(g>0){if(c=n.pow(c),y.eq(c)){g=0;break}y=c,--g}else{if(c=c.log(n),y.eq(c)){g=0;break}y=c,++g}return(100==p||this.lt(s))&&(g=0),c.setOperator(c.getOperator(1)+g,1),c.normalize(),c}},{key:"slog",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=this.clone(),a=new r(e);if(t.isInfiNaN())return t;if(a.isNaN())return a;if(a.isInfi())return r.ZERO.clone();if(t.isZero())return r.ONE.clone();if(t.eq(r.ONE))return r.ZERO.clone();if(t.eq(a))return r.ONE.clone();if(a.lt(s)){var n=a.tetrate(1/0);if(t.eq(n))return r.POSITIVE_INFINITY.clone();if(t.gt(n))return r.NaN.clone()}if(t.max(a).gt(r.PENTATED_MSI))return t.gt(a)?t:r.ZERO.clone();if(t.max(a).gt(r.TETRATED_MSI)&&t.gt(a))return t.setOperator(t.getOperator(2)-1,2),t.normalize(),t.sub(t.getOperator(1));if(t.lt(r.ZERO.clone()))return a.pow(t).sub(2);var i=0,o=t.getOperator(1)-a.getOperator(1);if(o>3){var l=o-3;i+=l,t.setOperator(t.getOperator(1)-l,1)}for(var u=0;u<100;++u){if(t.lte(r.ONE))return new r(i+t.toNumber());++i,t=r.log(t,e)}return console.warn("Failed to converage"),r.NaN.clone()}},{key:"abs",value:function(){var r=this.clone();return r.sign<0&&(r.sign*=-1),r}},{key:"log10",value:function(){if(this.isneg())return r.NaN.clone();if(this.isZero())return r.NEGATIVE_INFINITY.clone();if(this.small){var e=this.clone();return e.small=!e.small,e.log10().neg()}if(1==this.array.length)return new r(Math.log10(this.array[0].repeat));if(this.gte(r.TETRATED_MSI))return this.clone();var t=this.clone();return t.array[1].repeat=t.array[1].repeat-1,t.normalize(),t}},{key:"log",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Math.E,t=new r(e);return this.log10().div(t.log10())}},{key:"ln",value:function(){return this.log()}},{key:"exp",value:function(){return this.pow_base(Math.E)}},{key:"mod",value:function(e){var t=new r(e),a=this.div(t);return a.sub(a.floor()).mul(t)}},{key:"factorial",value:function(){return this.abs().lt(i)?this.add(1).gamma():this.abs().lt(r.E_MSI)?r.exp(this.mul(this.log10().sub(1))):r.exp(this)}},{key:"gamma",value:function(){if(this.small)return this.rec();if(this.lte(i)){if(this.lt(24))return r.fromNumber(function(r){if(!isFinite(r))return r;if(r<-50)return r===Math.trunc(r)?Number.NEGATIVE_INFINITY:0;for(var e=1;r<10;)e*=r,++r;var t=.9189385332046727;t+=((r-=1)+.5)*Math.log(r),t-=r;var a=r*r,n=r;return t+=1/(12*n),t-=1/(360*(n*=a)),t+=1/(1260*(n*=a)),t-=1/(1680*(n*=a)),t+=1/(1188*(n*=a)),t-=691/(360360*(n*=a)),t+=7/(1092*(n*=a)),t-=3617/(122400*(n*=a)),Math.exp(t)/e}(this.sign*this.getOperator(0)));var e=this.getOperator(0)-1,t=.9189385332046727;t+=(e+.5)*Math.log(e);var a=e*e,n=e,o=12*n,s=1/o,l=(t-=e)+s;if(l===t)return r.exp(t);if((l=(t=l)-(s=1/(o=360*(n*=a))))===t)return r.exp(t);t=l;var u=1/(o=1260*(n*=a));return t+=u,t-=u=1/(o=1680*(n*=a)),r.exp(t)}return this.gt(i)?r.exp(this.mul(this.log().sub(1))):r.exp(this)}},{key:"lambertw",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.lt(-.3678794411710499)?r.NaN.clone():e?this.abs().lt("1e-300")?new r(this):this.small?r.fromNumber(c(this.toNumber())):this.lt(i)?r.fromNumber(c(this.sign*this.getOperator(0))):this.lt("eee15")?m(this):this.log():1===this.sign?r.NaN.clone():0===this.layer?r.fromNumber(c(this.sign*this.array[0].repeat,1e-10,!1)):1==this.layer?m(this,1e-10,!1):this.neg().rec().lambertw().neg()}},{key:"arrow",value:function(e){var t=this.clone(),a=new r(e);return!a.isInt()||a.lt(r.ZERO)?(console.warn("The arrow is <0 or not a integer, the returned function will return NaN."),function(){return r.NaN.clone()}):a.eq(0)?function(r){return t.mul(r)}:a.eq(1)?function(r){return t.pow(r)}:a.eq(2)?function(r){return t.tetrate(r)}:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=new r(e),s=r.arrowFuncMap.get("".concat(t.toString()," ").concat(a.toString()," ").concat(o.toString()));if(s)return s.clone();var l=function(){var e;if(t.isNaN()||o.isNaN())return r.NaN.clone();if(o.lt(r.ZERO))return r.NaN.clone();if(t.eq(r.ZERO))return o.eq(r.ONE)?r.ZERO.clone():r.NaN.clone();if(t.eq(r.ONE))return r.ONE.clone();if(o.eq(r.ZERO))return r.ONE.clone();if(o.eq(r.ONE))return t.clone();if(a.gt(r.MSI))return(e=a.clone()).setOperator(e.getOperator(1/0)+1,1/0),e;var s=a.toNumber();if(o.eq(2))return t.arrow(s-1)(t,n+1);if(t.max(o).gt(r.arrowMSI(s+1)))return t.max(o);if(t.gt(r.arrowMSI(s))||o.gt(i)){t.gt(r.arrowMSI(s))?((e=t.clone()).setOperator(e.getOperator(s)-1,s),e.normalize()):e=t.gt(r.arrowMSI(s-1))?new r(t.getOperator(s-1)):r.ZERO;var l=e.add(o);return l.setOperator(l.getOperator(s)+1,s),l.normalize(),l}if(n>=r.maxOps+10)return new r([[0,10],[s,1]]);var u=o.toNumber(),h=Math.floor(u),f=a.sub(r.ONE);e=t.arrow(f)(u-h,n+1);for(var g=0,c=r.arrowMSI(s-1);0!==h&&e.lt(c)&&g<100;g++)h>0&&(e=t.arrow(f)(e,n+1),--h);return 100==g&&(h=0),e.setOperator(e.getOperator(s-1)+h,s-1),e.normalize(),e}();return r.arrowFuncMap.set("".concat(t.toString()," ").concat(a.toString()," ").concat(o.toString()),l.clone()),l}}},{key:"chain",value:function(r,e){return this.arrow(e)(r)}},{key:"max",value:function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return r.max.apply(r,[this].concat(t))}},{key:"min",value:function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return r.min.apply(r,[this].concat(t))}},{key:"maxabs",value:function(){for(var e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];var i=a.map((function(e){return new r(e).abs()}));return r.max.apply(r,[this.abs()].concat(t(i)))}},{key:"minabs",value:function(){for(var e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];var i=a.map((function(e){return new r(e).abs()}));return r.min.apply(r,[this.abs()].concat(t(i)))}},{key:"cmpabs",value:function(e){var t=new r(e).abs();return this.abs().cmp(t)}},{key:"neg",value:function(){var r=this.clone();return r.sign*=-1,r.normalize(),r}},{key:"rec",value:function(){var r=this.clone();return r.small=!r.small,r}},{key:"floor",value:function(){if(this.isInt())return this.clone();if(this.small)return 1==this.sign?r.ZERO.clone():r.ONE.neg().clone();var e=this.abs();return e.array[0].repeat=Math[1==this.sign?"floor":"ceil"](e.getOperator(0)),e}},{key:"ceil",value:function(){if(this.isInt())return this.clone();if(this.small)return 1==this.sign?r.ONE.clone():r.ZERO.clone();var e=this.abs();return e.array[0].repeat=Math[1==this.sign?"ceil":"floor"](e.getOperator(0)),e.sign=this.sign,e}},{key:"round",value:function(){if(this.isInt())return this.clone();if(this.small)return 1==this.sign?this.rec().lte(2)?r.ONE.clone():r.ZERO.clone():this.abs().rec().lte(2)?r.ZERO.clone():r.ONE.neg().clone();var e=this.abs();return e.array[0].repeat=Math.round(e.array[0].repeat),e.sign=this.sign,e}},{key:"trunc",value:function(){var r=this.clone();return r.gte(0)?r.floor():r.ceil()}},{key:"compare",value:function(e){var t=new r(e);if(this.isNaN()||t.isNaN())return 2;if(this.sign<t.sign)return-1;if(this.sign>t.sign)return 1;var a=-1==this.sign&&-1==t.sign;if(this.small&&!t.small)return-1*(a?-1:1);if(t.small&&!this.small)return 1*(a?-1:1);var n=1;this.small&&t.small&&(n*=-1),a&&(n*=-1);for(var i=0,o=0;this.array.length-1-o>=0&&t.array.length-1-o>=0;o++){var s=this.array[this.array.length-1-o],l=t.array[t.array.length-1-o],u=h([s.megota,s.expans,s.arrow,s.repeat],[l.megota,l.expans,l.arrow,l.repeat]);if(1==u){i=1;break}if(-1==u){i=-1;break}}return i*n+1-1}},{key:"cmp",value:function(r){return this.compare(r)}},{key:"eq",value:function(r){return 0===this.cmp(r)}},{key:"neq",value:function(r){return 0!==this.cmp(r)}},{key:"lt",value:function(r){return-1===this.cmp(r)}},{key:"lte",value:function(r){return this.cmp(r)<=0}},{key:"gt",value:function(r){return 1==this.cmp(r)}},{key:"gte",value:function(r){var e=this.cmp(r);return 0==e||1==e}},{key:"isNaN",value:function(r){function e(){return r.apply(this,arguments)}return e.toString=function(){return r.toString()},e}((function(){return isNaN(this.getOperator(0))}))},{key:"isZero",value:function(){return Boolean(this.small&&!isFinite(this.getOperator(0)))}},{key:"isFinite",value:function(r){function e(){return r.apply(this,arguments)}return e.toString=function(){return r.toString()},e}((function(){return Boolean(this.small||isFinite(this.getOperator(0)))&&!this.isNaN()}))},{key:"isInfi",value:function(){return this.rec().isZero()}},{key:"isInfiNaN",value:function(){return this.isInfi()||this.isNaN()}},{key:"isInt",value:function(){return!!this.isZero()||(!(this.small||!Number.isInteger(this.getOperator(0)))||!!this.abs().gte(i/2))}},{key:"ispos",value:function(){return this.sign>0}},{key:"isneg",value:function(){return this.sign<0}},{key:"normalize",value:function(){for(var e=!0,t=this,a=0;a<this.array.length;a++)if(this.array[a].repeat==1/0)return this.array=[{arrow:0,expans:1,megota:1,repeat:1/0}],this.layer=0,this;for(var n=1;n<t.array.length;++n){var s=t.array[n];if(null!==s.arrow&&void 0!==s.arrow||(s.arrow=0),null!==s.expans&&void 0!==s.expans||(s.expans=1),null!==s.megota&&void 0!==s.megota||(s.megota=1),isNaN(s.arrow)||isNaN(s.repeat)||isNaN(s.expans)||isNaN(s.megota))return t.array=[u(NaN,0,1,1)],t;if(!isFinite(s.repeat)||!isFinite(s.megota))return t.array=[u(1/0,0,1,1)],t;Number.isInteger(s.arrow)||(s.arrow=Math.floor(s.arrow)),Number.isInteger(s.repeat)||(s.repeat=Math.floor(s.repeat)),Number.isInteger(s.expans)||(s.expans=Math.floor(s.expans)),Number.isInteger(s.megota)||(s.megota=Math.floor(s.megota))}t.array.length||(t.small=!t.small,t.array=[u(1/0)]);do{for(e=!1,this.array.sort((function(r,e){return h([r.megota,r.expans,r.arrow],[e.megota,e.expans,e.arrow])})),n=1;n<t.array.length-1;++n)t.array[n].arrow==t.array[n+1].arrow&&t.array[n].expans==t.array[n+1].expans&&t.array[n].megota==t.array[n+1].megota&&(t.array[n].repeat+=t.array[n+1].repeat,t.array.splice(n+1,1),--n,e=!0);for(n=1;n<t.array.length;++n)0===t.array[n].arrow||0!==t.array[n].repeat&&null!==t.array[n].repeat&&void 0!==t.array[n].repeat?0==t.array[n].arrow&&t.array[n].expans>=2&&(t.array[n].arrow=1/0,t.array[n].valuereplaced=0,t.array[n].expans=t.array[n].expans-1):(t.array.splice(n,1),--n);for(t.array.length>r.maxOps&&t.array.splice(1,t.array.length-r.maxOps),this.getOperator(1)>=1&&this.getOperator(0)<o&&(this.setOperator(this.getOperator(1)-1,1),this.setOperator(Math.pow(10,this.getOperator(0)),0),e=!0),this.getOperator(0)>i&&!isFinite(this.getOperator(0))&&(this.setOperator(this.getOperator(1)+1,1),this.setOperator(Math.log10(this.getOperator(0)),0),e=!0),1==this.array.length&&this.array[0].repeat<1&&(this.array[0].repeat=1/this.array[0].repeat,this.small=!this.small,e=!0);t.array.length>=2&&1==t.array[0].repeat&&t.array[1].repeat;)t.array[1].repeat>1?t.array[1].repeat--:t.array.splice(1,1),t.array[0].repeat=10,e=!0;t.array.length>=2&&t.array[0].repeat<i&&t.array[1].arrow>=2&&1==t.array[1].repeat&&isFinite(t.array[1].arrow)&&(t.array.splice(1,1,u(t.array[0].repeat,t.array[1].arrow-1,t.array[1].expans,t.array[1].megota)),t.array[0].repeat=10,e=!0),t.array.length>=2&&t.array[1].repeat>i&&(t.array[1].arrow++,t.array[0].repeat=t.array[1].repeat,t.array[1].repeat=1,e=!0)}while(e);return this}},{key:"getOperatorIndex",value:function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(1==this.array.length&&0==r)return 0;if(1==this.array.length&&1==r)return.5;if(2==this.array.length&&1==r)return 1;if(2==this.array.length&&0==r)return 0;for(var a=0;a<this.array.length;a++){var n=h([this.array[a].megota,this.array[a].expans,this.array[a].arrow],[t,e,r]);if(0==n)return a;if(1==n)return a-.5}return this.array.length-.5}},{key:"getOperator",value:function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=this.getOperatorIndex(r,e,t);return this.array[a]?this.array[a].repeat:0}},{key:"setOperator",value:function(r,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=this.getOperatorIndex(e,t,a);return this.array[n]?(this.array[n].repeat=r,!1):(this.array.splice(Math.ceil(n),0,{arrow:e,expans:t,megota:a,valuereplaced:t===1/0?1:e==1/0?0:-1,repeat:r}),!0)}},{key:"clone",value:function(){var e=new r;return e.resetFromObject(this),e}},{key:"resetFromObject",value:function(r){this.array=[];for(var e=0;e<r.array.length;e++)this.array[e]={arrow:r.array[e].arrow,expans:r.array[e].expans,megota:r.array[e].megota,repeat:r.array[e].repeat,valuereplaced:r.array[e].valuereplaced};return this.small=r.small,this.sign=r.sign,this.layer=r.layer,this}},{key:"toNumber",value:function(){return-1==this.sign?-this.neg().toNumber():this.small?1/this.rec().toNumber():this.array.length>2?1/0:1==this.array.length?this.array[0].repeat:2==this.array.length&&1==this.array[1].arrow&&1==this.array[1].expans&&1==this.array[1].megota&&1==this.array[1].repeat?Math.pow(10,this.getOperator(0)):NaN}},{key:"toString",value:function(){if(this.isNaN())return"NaN";if(-1==this.sign)return"-".concat(this.neg().toString());if(this.small)return this.isZero()?"0":"/".concat(this.rec().toString());if(this.isInfi())return"Infinity";for(var r="",e=this.array.length-1;e>=0;e--){var t=this.array[e],a="10{".concat(t.arrow===1/0?"!":t.arrow).concat(t.expans>1||t.megota>1?",".concat(t.expans===1/0?"!":t.expans):"").concat(t.megota>1?",".concat(t.megota):"","}");a=1==t.arrow&&1==t.expans&&1==t.megota&&t.repeat<5?"e".repeat(t.repeat):0==t.arrow&&1==t.expans&&1==t.megota?t.repeat.toString():t.repeat>1?"(".concat(a,")^").concat(t.repeat," "):"".concat(a),r+="".concat(a)}return r}},{key:"toJSON",value:function(){return"PN"+this.toString()}},{key:"arr01",get:function(){for(var r=[0],e=0;e<this.array.length;e++)0==e?r[0]=this.array[e].repeat:(r[e]=[0,0,0,0],r[e][0]=this.array[e].arrow==1/0?"x":this.array[e].arrow,r[e][1]=this.array[e].repeat,r[e][2]=this.array[e].expans==1/0?"x":this.array[e].expans,r[e][3]=this.array[e].megota);return r}}],[{key:"add",value:function(e,t){return new r(e).add(t)}},{key:"sub",value:function(e,t){return new r(e).sub(t)}},{key:"mul",value:function(e,t){return new r(e).mul(t)}},{key:"div",value:function(e,t){return new r(e).div(t)}},{key:"pow",value:function(e,t){return new r(e).pow(t)}},{key:"root",value:function(e,t){return new r(e).root(t)}},{key:"sqrt",value:function(e){return new r(e).sqrt()}},{key:"cbrt",value:function(e){return new r(e).cbrt()}},{key:"tetrate",value:function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return new r(e).tetrate(t,a)}},{key:"log10",value:function(e){return new r(e).log10()}},{key:"log",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Math.E;return new r(e).log(t)}},{key:"exp",value:function(e){return new r(e).pow_base(Math.E)}},{key:"factorial",value:function(e){return new r(e).factorial()}},{key:"gamma",value:function(e){return new r(e).gamma()}},{key:"lambertw",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return new r(e).lambertw(t)}},{key:"tetrate_10",value:function(e){return r.fromNumber(10).tetrate(e)}},{key:"max",value:function(){for(var e=r.NEGATIVE_INFINITY,t=arguments.length,a=new Array(t),n=0;n<t;n++)a[n]=arguments[n];for(var i=0;i<a.length;i++)e.lt(a[i])&&(e=new r(a[i]).clone());return e}},{key:"min",value:function(){for(var e=r.POSITIVE_INFINITY,t=arguments.length,a=new Array(t),n=0;n<t;n++)a[n]=arguments[n];for(var i=0;i<a.length;i++)e.gt(a[i])&&(e=new r(a[i]).clone());return e}},{key:"clampMin",value:function(){return r.max.apply(r,arguments)}},{key:"clampMax",value:function(){return r.min.apply(r,arguments)}},{key:"sign",value:function(e){return new r(e).sign}},{key:"isNaN",value:function(e){return new r(e).isNaN()}},{key:"arrowMSI",value:function(e){return new r("10".concat(e).concat(i))}},{key:"fromNumber",value:function(e){var t=new r;if(e<0)t.sign=-1;else{if(0==e)return t.sign=0,t.small=!0,t.array=[u(1/0,0)],t;e>0&&(t.sign=1)}var a=Math.abs(e);return a>=11102230246251568e-32&&a<1?(t.small=!0,t.array=[u(1/a,0)]):a<11102230246251568e-32?(t.small=!0,t.array=[u(-Math.log10(a),0),u(1,1)]):a<=i?t.array=[u(a,0)]:(t.setOperator(Math.log10(a),0),t.array=[u(Math.log10(a),0),u(1,1)]),t}},{key:"fromString",value:function(e){var t,a,n,s,h,g,c,y=new r;if(e.startsWith("PN")&&(e=e.substring(2)),!isNaN(Number(e))){var p=Number(e),m=!1;if(0==p?/^(0*\.0*e)|(0*\.0*)$/.test(e)&&(m=!0):m=!0,!m){var v=e.search(/e/),N=e.substring((-1==v?e.length:v)+1),w=e.substring(0,-1==v?void 0:v),b=[0,0];if(b[1]=Number(N||"0"),Number(w)>=1){var I=w.length>=17?f(w):Math.log10(Number(w)),d=I-(Math.floor(I)-1);b[0]=Math.pow(10,d),b[1]+=d}else{var O=(c=w.match(/^0\.(0*)[1-9]/))?c[1].length:0;w=(w=w.substring(w.search(/[1-9]/))).charAt(0)+"."+w.substring(1),O+=1,b[0]=Number(w),b[1]+=-O}return r.pow(10,-b[1]-1).mul(10*Math.pow(b[0],-1)).rec()}if(isFinite(p)&&m)return y.resetFromObject(r.fromNumber(Number(e))),y}if(e=e.replace(/\(e\^(\d+)\)/g,"(10^)^$1 ").replace(/(\d+)\x20*PT/g,"(10^)^$1 "),!l.test(e))throw"[PowiainaNum 0.2 error]malformed input: "+e;var E=!1,M=!1;if("-"==e[0]||"+"==e[0]){var k=e.search(/[^-\+]/);E=(null!==(a=null===(t=e.substring(0,k).match(/-/g))||void 0===t?void 0:t.length)&&void 0!==a?a:0)%2==1,e=e.substring(k)}if("/"==e[0]){k=e.search(/[^\/]/);M=(null!==(s=null===(n=e.substring(0,k).match(/\//g))||void 0===n?void 0:n.length)&&void 0!==s?s:0)%2==1,e=e.substring(k)}if("NaN"==e)y.array=[u(NaN)];else if("Infinity"==e)y.array=[u(1/0)];else{var x,T,S,F;for(y.sign=1,y.array=[u(0)];e&&/^(\(?10[\^\{])/.test(e);){var _,q,A;if("("==e[0]&&(e=e.substring(1)),"^"==e[2])_=x=e.substring(2).search(/[^\^]/),T=x+2;else{x=e.indexOf("}");var R=e.substring(3,x).split(",");_=Number("!"==R[0]?1/0:R[0]),q=Number(null!==(h="!"==R[1]?1/0:R[1])&&void 0!==h?h:1),A=Number(null!==(g=R[2])&&void 0!==g?g:1),T=x+1}")"==(e=e.substring(T))[0]?(x=e.indexOf(" "),S=Number(e.substring(2,x)),e=e.substring(x+1)):S=1,1==_&&1==q&&1==A?y.array.length>=2&&1==y.array[1].arrow?y.array[1].repeat+=S:y.array.splice(1,0,u(S,1,q,A)):2==_&&1==q&&1==A?(x=y.array.length>=2&&1==y.array[1].arrow?y.array[1].repeat:0,(T=y.array[0].repeat)>=1e10&&++x,T>=10&&++x,y.array[0].repeat=x,y.array.length>=2&&1==y.array[1].arrow&&y.array.splice(1,1),F=y.getOperatorIndex(2),Number.isInteger(F)?y.array[F].repeat+=S:y.array.splice(Math.ceil(F),0,u(S,2,q,A))):isFinite(_)?(x=y.getOperator(_-1),(T=y.getOperator(_-2))>=10&&++x,F=y.getOperatorIndex(_),y.array.splice(1,Math.ceil(F)-1),y.array[0].repeat=x,Number.isInteger(F)?y.array[1].repeat+=S:y.array.splice(1,0,u(S,_,q,A))):y.array.splice(1,0,u(S,_,q,A))}x=e.split(/[Ee]/),T=[y.array[0].repeat,0],S=1;for(var Z=x.length-1;Z>=0;--Z){T[0]<o&&0===T[1]?T[0]=Math.pow(10,S*T[0]):-1==S?(0===T[1]?T[0]=Math.pow(10,S*T[0]):1==T[1]&&T[0]<=Math.log10(Number.MAX_VALUE)?T[0]=Math.pow(10,S*Math.pow(10,T[0])):T[0]=0,T[1]=0):T[1]++;var P=x[Z].indexOf("."),V=-1==P?x[Z].length:P;0===T[1]?V>=17?(T[0]=Math.log10(T[0])+f(x[Z].substring(0,V)),T[1]=1):x[Z]&&(T[0]*=Number(x[Z])):(F=V>=17?f(x[Z].substring(0,V)):x[Z]?Math.log10(Number(x[Z])):0,1==T[1]?T[0]+=F:2==T[1]&&T[0]<o+Math.log10(F)&&(T[0]+=Math.log10(1+Math.pow(10,Math.log10(F)-T[0])))),T[0]<o&&T[1]?(T[0]=Math.pow(10,T[0]),T[1]--):T[0]>i&&(T[0]=Math.log10(T[0]),T[1]++)}y.array[0].repeat=T[0],T[1]&&(y.array.length>=2&&1==y.array[1].arrow?y.array[1].repeat+=T[1]:y.array.splice(1,0,u(T[1],1,1,1)))}return E&&(y.sign*=-1),M&&(y.small=!y.small),y.normalize(),y.normalize(),y}},{key:"fromObject",value:function(e){var t=new r;if(t.array=[],function(r){if(!Array.isArray(r))return!1;for(var e=0;e<r.length;e++){var t=r[e];if(!Array.isArray(t))return!1;if(!y(t))return!1;if(!p(t))return!1}return!0}(e)){for(var a=0;a<e.length;a++)t.array[a]={arrow:e[a][0],expans:1,megota:1,repeat:e[a][1]};return t.small=!1,t.sign=1,t.layer=0,t.normalize(),t}for(var n=0;n<e.array.length;n++)t.array[n]={arrow:e.array[n].arrow,expans:e.array[n].expans,megota:e.array[n].megota,repeat:e.array[n].repeat,valuereplaced:e.array[n].valuereplaced};return t.small=e.small,t.sign=e.sign,t.layer=e.layer,t}}])}();return N.ZERO=new N({array:[{arrow:0,expans:1,megota:1,repeat:1/0}],small:!0,layer:0,sign:0}),N.ONE=new N({array:[{arrow:0,expans:1,megota:1,repeat:1}],small:!1,layer:0,sign:1}),N.MSI=new N(i),N.MSI_REC=((v=new N(i)).small=!0,v),N.E_MSI=new N({array:[{arrow:0,expans:1,megota:1,repeat:i},{arrow:1,expans:1,megota:1,repeat:1}],small:!1,layer:0,sign:1}),N.E_MSI_REC=new N({array:[{arrow:0,expans:1,megota:1,repeat:i},{arrow:1,expans:1,megota:1,repeat:1}],small:!0,layer:0,sign:1}),N.TETRATED_MSI=new N({array:[{arrow:0,expans:1,megota:1,repeat:1e10},{arrow:1,expans:1,megota:1,repeat:i-2}],small:!1,layer:0,sign:1}),N.PENTATED_MSI=new N({array:[{arrow:0,expans:1,megota:1,repeat:10},{arrow:2,expans:1,megota:1,repeat:i-1}],small:!1,layer:0,sign:1}),N.TRITRI=new N({small:!1,layer:0,sign:1,array:[u(3638334640023.7783,0,1,1),u(7625587484984,1,1,1)]}),N.GRAHAMS_NUMBER=new N("(10{!})^63 10^^^(10^)^7625597484984 3638334640023.7783"),N.POSITIVE_INFINITY=new N(1/0),N.NEGATIVE_INFINITY=new N(-1/0),N.NaN=new N({array:[{arrow:0,expans:1,megota:1,repeat:NaN}],small:!1,layer:0,sign:0}),N.E=new N(Math.E),N.LN2=new N(Math.LN2),N.LN10=new N(Math.LN10),N.LOG2E=new N(Math.LOG2E),N.LOG10E=new N(Math.LOG10E),N.PI=new N(Math.PI),N.SQRT1_2=new N(Math.SQRT1_2),N.SQRT2=new N(Math.SQRT2),N.maxOps=100,N.arrowFuncMap=new Map,N}));
|