powiaina_num.js 0.2.0-alpha.3.1 → 0.2.0-alpha.3.3
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/dist/PowiainaNum.cjs.js +73 -12
- package/dist/PowiainaNum.esm.js +73 -12
- package/dist/PowiainaNum.js +73 -12
- package/dist/PowiainaNum.min.js +1 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +313 -45
- package/dist/types/index.d.ts +140 -5
- package/package.json +1 -1
package/dist/PowiainaNum.cjs.js
CHANGED
|
@@ -68,7 +68,7 @@ var MSI_LOG10 = 15.954589770191003;
|
|
|
68
68
|
var MSI_REC = 1.1102230246251568e-16;
|
|
69
69
|
var LONG_STRING_MIN_LENGTH = 17;
|
|
70
70
|
var EXP_E_REC = 1.444667861009766;
|
|
71
|
-
var isPowiainaNum = /^(PN)
|
|
71
|
+
var isPowiainaNum = /^(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+))$/;
|
|
72
72
|
function newOperator(r) {
|
|
73
73
|
var a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
74
74
|
var e = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
@@ -258,7 +258,6 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
258
258
|
*/
|
|
259
259
|
function PowiainaNum(arg1) {
|
|
260
260
|
_classCallCheck(this, PowiainaNum);
|
|
261
|
-
this.a = Number.MAX_SAFE_INTEGER;
|
|
262
261
|
this.array = [{
|
|
263
262
|
arrow: 0,
|
|
264
263
|
expans: 1,
|
|
@@ -466,7 +465,7 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
466
465
|
}, {
|
|
467
466
|
key: "cbrt",
|
|
468
467
|
value: function cbrt() {
|
|
469
|
-
return this.root(3);
|
|
468
|
+
return this.abs().root(3).mul(this.sign);
|
|
470
469
|
}
|
|
471
470
|
}, {
|
|
472
471
|
key: "tetrate",
|
|
@@ -582,11 +581,17 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
582
581
|
x.setOperator(x.getOperator(1) - l, 1);
|
|
583
582
|
}
|
|
584
583
|
for (var i = 0; i < 100; ++i) {
|
|
585
|
-
if (x.
|
|
586
|
-
|
|
587
|
-
|
|
584
|
+
if (x.lt(PowiainaNum.ZERO)) {
|
|
585
|
+
x = PowiainaNum.pow(base, x);
|
|
586
|
+
--r;
|
|
587
|
+
} else if (x.lte(1)) {
|
|
588
|
+
return new PowiainaNum(r + x.toNumber() - 1);
|
|
589
|
+
} else {
|
|
590
|
+
++r;
|
|
591
|
+
x = PowiainaNum.log(x, base);
|
|
592
|
+
}
|
|
588
593
|
}
|
|
589
|
-
|
|
594
|
+
if (x.gt(10)) return new PowiainaNum(r);
|
|
590
595
|
return PowiainaNum.NaN.clone();
|
|
591
596
|
}
|
|
592
597
|
}, {
|
|
@@ -626,6 +631,41 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
626
631
|
value: function ln() {
|
|
627
632
|
return this.log();
|
|
628
633
|
}
|
|
634
|
+
/**
|
|
635
|
+
* plog10, beware unexpected errors.
|
|
636
|
+
*/
|
|
637
|
+
}, {
|
|
638
|
+
key: "plog10",
|
|
639
|
+
value: function plog10() {
|
|
640
|
+
return this.max(1).log10();
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* plog10, beware unexpected errors.
|
|
644
|
+
*/
|
|
645
|
+
}, {
|
|
646
|
+
key: "plog",
|
|
647
|
+
value:
|
|
648
|
+
/**
|
|
649
|
+
* plog, beware unexpected errors.
|
|
650
|
+
*/
|
|
651
|
+
function plog() {
|
|
652
|
+
var base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Math.E;
|
|
653
|
+
// log_a b = log_x b / log_x a;
|
|
654
|
+
var other = new PowiainaNum(base);
|
|
655
|
+
return this.plog10().div(other.plog10());
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* plog, beware unexpected errors.
|
|
659
|
+
*/
|
|
660
|
+
}, {
|
|
661
|
+
key: "pln",
|
|
662
|
+
value:
|
|
663
|
+
/**
|
|
664
|
+
* pln, beware unexpected errors.
|
|
665
|
+
*/
|
|
666
|
+
function pln() {
|
|
667
|
+
return this.plog();
|
|
668
|
+
}
|
|
629
669
|
}, {
|
|
630
670
|
key: "exp",
|
|
631
671
|
value: function exp() {
|
|
@@ -727,7 +767,7 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
727
767
|
} else if (principal) {
|
|
728
768
|
if (this.abs().lt("1e-300")) return new PowiainaNum(this);else if (this.small) {
|
|
729
769
|
return PowiainaNum.fromNumber(f_lambertw(this.toNumber()));
|
|
730
|
-
} else if (this.
|
|
770
|
+
} else if (this.lt(MSI)) {
|
|
731
771
|
return PowiainaNum.fromNumber(f_lambertw(this.sign * this.getOperator(0)));
|
|
732
772
|
} else if (this.lt("eee15")) {
|
|
733
773
|
return d_lambertw(this);
|
|
@@ -771,7 +811,7 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
771
811
|
return function (other2) {
|
|
772
812
|
var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
773
813
|
var other = new PowiainaNum(other2);
|
|
774
|
-
var ctt = PowiainaNum.arrowFuncMap.get("".concat(t.toString(), " ").concat(arrows.toString(), " ").concat(other.toString()));
|
|
814
|
+
var ctt = PowiainaNum.arrowFuncMap.get("".concat(t.toString(), " ").concat(arrows.toString(), " ").concat(other.toString(), " ").concat(depth));
|
|
775
815
|
if (ctt) return ctt.clone();
|
|
776
816
|
var res = function () {
|
|
777
817
|
var r;
|
|
@@ -784,12 +824,15 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
784
824
|
if (t.eq(PowiainaNum.ONE)) return PowiainaNum.ONE.clone();
|
|
785
825
|
if (other.eq(PowiainaNum.ZERO)) return PowiainaNum.ONE.clone();
|
|
786
826
|
if (other.eq(PowiainaNum.ONE)) return t.clone();
|
|
827
|
+
// arrow > 9e15, that using 10{x}, x=arrow;
|
|
787
828
|
if (arrows.gt(PowiainaNum.MSI)) {
|
|
788
829
|
r = arrows.clone();
|
|
789
830
|
r.setOperator(r.getOperator(Infinity) + 1, Infinity);
|
|
790
831
|
return r;
|
|
791
832
|
}
|
|
792
833
|
var arrowsNum = arrows.toNumber();
|
|
834
|
+
// arrow < 9e15
|
|
835
|
+
// 10{x}2 = 10{x-1}10
|
|
793
836
|
if (other.eq(2)) return t.arrow(arrowsNum - 1)(t, depth + 1);
|
|
794
837
|
if (t.max(other).gt(PowiainaNum.arrowMSI(arrowsNum + 1))) return t.max(other);
|
|
795
838
|
if (t.gt(PowiainaNum.arrowMSI(arrowsNum)) || other.gt(MSI)) {
|
|
@@ -808,7 +851,12 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
808
851
|
return j;
|
|
809
852
|
}
|
|
810
853
|
if (depth >= PowiainaNum.maxOps + 10) {
|
|
811
|
-
return new PowiainaNum(
|
|
854
|
+
return new PowiainaNum({
|
|
855
|
+
small: false,
|
|
856
|
+
sign: 1,
|
|
857
|
+
layer: 0,
|
|
858
|
+
array: [newOperator(10, 0), newOperator(1, arrowsNum)]
|
|
859
|
+
});
|
|
812
860
|
}
|
|
813
861
|
var y = other.toNumber();
|
|
814
862
|
var f = Math.floor(y);
|
|
@@ -826,7 +874,9 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
826
874
|
r.normalize();
|
|
827
875
|
return r;
|
|
828
876
|
}();
|
|
829
|
-
|
|
877
|
+
if (depth < PowiainaNum.maxOps + 10) {
|
|
878
|
+
PowiainaNum.arrowFuncMap.set("".concat(t.toString(), " ").concat(arrows.toString(), " ").concat(other.toString(), " ").concat(depth), res.clone());
|
|
879
|
+
}
|
|
830
880
|
return res;
|
|
831
881
|
};
|
|
832
882
|
}
|
|
@@ -1437,6 +1487,17 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
1437
1487
|
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Math.E;
|
|
1438
1488
|
return new PowiainaNum(t).log(base);
|
|
1439
1489
|
}
|
|
1490
|
+
}, {
|
|
1491
|
+
key: "plog10",
|
|
1492
|
+
value: function plog10(t) {
|
|
1493
|
+
return new PowiainaNum(t).plog10();
|
|
1494
|
+
}
|
|
1495
|
+
}, {
|
|
1496
|
+
key: "plog",
|
|
1497
|
+
value: function plog(t) {
|
|
1498
|
+
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Math.E;
|
|
1499
|
+
return new PowiainaNum(t).plog(base);
|
|
1500
|
+
}
|
|
1440
1501
|
}, {
|
|
1441
1502
|
key: "exp",
|
|
1442
1503
|
value: function exp(x) {
|
|
@@ -1560,7 +1621,7 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
1560
1621
|
}, {
|
|
1561
1622
|
key: "arrowMSI",
|
|
1562
1623
|
value: function arrowMSI(arrowsNum) {
|
|
1563
|
-
return new PowiainaNum("10".concat(arrowsNum).concat(MSI));
|
|
1624
|
+
return new PowiainaNum("10{".concat(arrowsNum, "}").concat(MSI));
|
|
1564
1625
|
}
|
|
1565
1626
|
}, {
|
|
1566
1627
|
key: "fromNumber",
|
package/dist/PowiainaNum.esm.js
CHANGED
|
@@ -66,7 +66,7 @@ var MSI_LOG10 = 15.954589770191003;
|
|
|
66
66
|
var MSI_REC = 1.1102230246251568e-16;
|
|
67
67
|
var LONG_STRING_MIN_LENGTH = 17;
|
|
68
68
|
var EXP_E_REC = 1.444667861009766;
|
|
69
|
-
var isPowiainaNum = /^(PN)
|
|
69
|
+
var isPowiainaNum = /^(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+))$/;
|
|
70
70
|
function newOperator(r) {
|
|
71
71
|
var a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
72
72
|
var e = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
@@ -256,7 +256,6 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
256
256
|
*/
|
|
257
257
|
function PowiainaNum(arg1) {
|
|
258
258
|
_classCallCheck(this, PowiainaNum);
|
|
259
|
-
this.a = Number.MAX_SAFE_INTEGER;
|
|
260
259
|
this.array = [{
|
|
261
260
|
arrow: 0,
|
|
262
261
|
expans: 1,
|
|
@@ -464,7 +463,7 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
464
463
|
}, {
|
|
465
464
|
key: "cbrt",
|
|
466
465
|
value: function cbrt() {
|
|
467
|
-
return this.root(3);
|
|
466
|
+
return this.abs().root(3).mul(this.sign);
|
|
468
467
|
}
|
|
469
468
|
}, {
|
|
470
469
|
key: "tetrate",
|
|
@@ -580,11 +579,17 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
580
579
|
x.setOperator(x.getOperator(1) - l, 1);
|
|
581
580
|
}
|
|
582
581
|
for (var i = 0; i < 100; ++i) {
|
|
583
|
-
if (x.
|
|
584
|
-
|
|
585
|
-
|
|
582
|
+
if (x.lt(PowiainaNum.ZERO)) {
|
|
583
|
+
x = PowiainaNum.pow(base, x);
|
|
584
|
+
--r;
|
|
585
|
+
} else if (x.lte(1)) {
|
|
586
|
+
return new PowiainaNum(r + x.toNumber() - 1);
|
|
587
|
+
} else {
|
|
588
|
+
++r;
|
|
589
|
+
x = PowiainaNum.log(x, base);
|
|
590
|
+
}
|
|
586
591
|
}
|
|
587
|
-
|
|
592
|
+
if (x.gt(10)) return new PowiainaNum(r);
|
|
588
593
|
return PowiainaNum.NaN.clone();
|
|
589
594
|
}
|
|
590
595
|
}, {
|
|
@@ -624,6 +629,41 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
624
629
|
value: function ln() {
|
|
625
630
|
return this.log();
|
|
626
631
|
}
|
|
632
|
+
/**
|
|
633
|
+
* plog10, beware unexpected errors.
|
|
634
|
+
*/
|
|
635
|
+
}, {
|
|
636
|
+
key: "plog10",
|
|
637
|
+
value: function plog10() {
|
|
638
|
+
return this.max(1).log10();
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* plog10, beware unexpected errors.
|
|
642
|
+
*/
|
|
643
|
+
}, {
|
|
644
|
+
key: "plog",
|
|
645
|
+
value:
|
|
646
|
+
/**
|
|
647
|
+
* plog, beware unexpected errors.
|
|
648
|
+
*/
|
|
649
|
+
function plog() {
|
|
650
|
+
var base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Math.E;
|
|
651
|
+
// log_a b = log_x b / log_x a;
|
|
652
|
+
var other = new PowiainaNum(base);
|
|
653
|
+
return this.plog10().div(other.plog10());
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* plog, beware unexpected errors.
|
|
657
|
+
*/
|
|
658
|
+
}, {
|
|
659
|
+
key: "pln",
|
|
660
|
+
value:
|
|
661
|
+
/**
|
|
662
|
+
* pln, beware unexpected errors.
|
|
663
|
+
*/
|
|
664
|
+
function pln() {
|
|
665
|
+
return this.plog();
|
|
666
|
+
}
|
|
627
667
|
}, {
|
|
628
668
|
key: "exp",
|
|
629
669
|
value: function exp() {
|
|
@@ -725,7 +765,7 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
725
765
|
} else if (principal) {
|
|
726
766
|
if (this.abs().lt("1e-300")) return new PowiainaNum(this);else if (this.small) {
|
|
727
767
|
return PowiainaNum.fromNumber(f_lambertw(this.toNumber()));
|
|
728
|
-
} else if (this.
|
|
768
|
+
} else if (this.lt(MSI)) {
|
|
729
769
|
return PowiainaNum.fromNumber(f_lambertw(this.sign * this.getOperator(0)));
|
|
730
770
|
} else if (this.lt("eee15")) {
|
|
731
771
|
return d_lambertw(this);
|
|
@@ -769,7 +809,7 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
769
809
|
return function (other2) {
|
|
770
810
|
var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
771
811
|
var other = new PowiainaNum(other2);
|
|
772
|
-
var ctt = PowiainaNum.arrowFuncMap.get("".concat(t.toString(), " ").concat(arrows.toString(), " ").concat(other.toString()));
|
|
812
|
+
var ctt = PowiainaNum.arrowFuncMap.get("".concat(t.toString(), " ").concat(arrows.toString(), " ").concat(other.toString(), " ").concat(depth));
|
|
773
813
|
if (ctt) return ctt.clone();
|
|
774
814
|
var res = function () {
|
|
775
815
|
var r;
|
|
@@ -782,12 +822,15 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
782
822
|
if (t.eq(PowiainaNum.ONE)) return PowiainaNum.ONE.clone();
|
|
783
823
|
if (other.eq(PowiainaNum.ZERO)) return PowiainaNum.ONE.clone();
|
|
784
824
|
if (other.eq(PowiainaNum.ONE)) return t.clone();
|
|
825
|
+
// arrow > 9e15, that using 10{x}, x=arrow;
|
|
785
826
|
if (arrows.gt(PowiainaNum.MSI)) {
|
|
786
827
|
r = arrows.clone();
|
|
787
828
|
r.setOperator(r.getOperator(Infinity) + 1, Infinity);
|
|
788
829
|
return r;
|
|
789
830
|
}
|
|
790
831
|
var arrowsNum = arrows.toNumber();
|
|
832
|
+
// arrow < 9e15
|
|
833
|
+
// 10{x}2 = 10{x-1}10
|
|
791
834
|
if (other.eq(2)) return t.arrow(arrowsNum - 1)(t, depth + 1);
|
|
792
835
|
if (t.max(other).gt(PowiainaNum.arrowMSI(arrowsNum + 1))) return t.max(other);
|
|
793
836
|
if (t.gt(PowiainaNum.arrowMSI(arrowsNum)) || other.gt(MSI)) {
|
|
@@ -806,7 +849,12 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
806
849
|
return j;
|
|
807
850
|
}
|
|
808
851
|
if (depth >= PowiainaNum.maxOps + 10) {
|
|
809
|
-
return new PowiainaNum(
|
|
852
|
+
return new PowiainaNum({
|
|
853
|
+
small: false,
|
|
854
|
+
sign: 1,
|
|
855
|
+
layer: 0,
|
|
856
|
+
array: [newOperator(10, 0), newOperator(1, arrowsNum)]
|
|
857
|
+
});
|
|
810
858
|
}
|
|
811
859
|
var y = other.toNumber();
|
|
812
860
|
var f = Math.floor(y);
|
|
@@ -824,7 +872,9 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
824
872
|
r.normalize();
|
|
825
873
|
return r;
|
|
826
874
|
}();
|
|
827
|
-
|
|
875
|
+
if (depth < PowiainaNum.maxOps + 10) {
|
|
876
|
+
PowiainaNum.arrowFuncMap.set("".concat(t.toString(), " ").concat(arrows.toString(), " ").concat(other.toString(), " ").concat(depth), res.clone());
|
|
877
|
+
}
|
|
828
878
|
return res;
|
|
829
879
|
};
|
|
830
880
|
}
|
|
@@ -1435,6 +1485,17 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
1435
1485
|
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Math.E;
|
|
1436
1486
|
return new PowiainaNum(t).log(base);
|
|
1437
1487
|
}
|
|
1488
|
+
}, {
|
|
1489
|
+
key: "plog10",
|
|
1490
|
+
value: function plog10(t) {
|
|
1491
|
+
return new PowiainaNum(t).plog10();
|
|
1492
|
+
}
|
|
1493
|
+
}, {
|
|
1494
|
+
key: "plog",
|
|
1495
|
+
value: function plog(t) {
|
|
1496
|
+
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Math.E;
|
|
1497
|
+
return new PowiainaNum(t).plog(base);
|
|
1498
|
+
}
|
|
1438
1499
|
}, {
|
|
1439
1500
|
key: "exp",
|
|
1440
1501
|
value: function exp(x) {
|
|
@@ -1558,7 +1619,7 @@ var PowiainaNum = /*#__PURE__*/function () {
|
|
|
1558
1619
|
}, {
|
|
1559
1620
|
key: "arrowMSI",
|
|
1560
1621
|
value: function arrowMSI(arrowsNum) {
|
|
1561
|
-
return new PowiainaNum("10".concat(arrowsNum).concat(MSI));
|
|
1622
|
+
return new PowiainaNum("10{".concat(arrowsNum, "}").concat(MSI));
|
|
1562
1623
|
}
|
|
1563
1624
|
}, {
|
|
1564
1625
|
key: "fromNumber",
|
package/dist/PowiainaNum.js
CHANGED
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
var MSI_REC = 1.1102230246251568e-16;
|
|
73
73
|
var LONG_STRING_MIN_LENGTH = 17;
|
|
74
74
|
var EXP_E_REC = 1.444667861009766;
|
|
75
|
-
var isPowiainaNum = /^(PN)
|
|
75
|
+
var isPowiainaNum = /^(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+))$/;
|
|
76
76
|
function newOperator(r) {
|
|
77
77
|
var a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
78
78
|
var e = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
@@ -262,7 +262,6 @@
|
|
|
262
262
|
*/
|
|
263
263
|
function PowiainaNum(arg1) {
|
|
264
264
|
_classCallCheck(this, PowiainaNum);
|
|
265
|
-
this.a = Number.MAX_SAFE_INTEGER;
|
|
266
265
|
this.array = [{
|
|
267
266
|
arrow: 0,
|
|
268
267
|
expans: 1,
|
|
@@ -470,7 +469,7 @@
|
|
|
470
469
|
}, {
|
|
471
470
|
key: "cbrt",
|
|
472
471
|
value: function cbrt() {
|
|
473
|
-
return this.root(3);
|
|
472
|
+
return this.abs().root(3).mul(this.sign);
|
|
474
473
|
}
|
|
475
474
|
}, {
|
|
476
475
|
key: "tetrate",
|
|
@@ -586,11 +585,17 @@
|
|
|
586
585
|
x.setOperator(x.getOperator(1) - l, 1);
|
|
587
586
|
}
|
|
588
587
|
for (var i = 0; i < 100; ++i) {
|
|
589
|
-
if (x.
|
|
590
|
-
|
|
591
|
-
|
|
588
|
+
if (x.lt(PowiainaNum.ZERO)) {
|
|
589
|
+
x = PowiainaNum.pow(base, x);
|
|
590
|
+
--r;
|
|
591
|
+
} else if (x.lte(1)) {
|
|
592
|
+
return new PowiainaNum(r + x.toNumber() - 1);
|
|
593
|
+
} else {
|
|
594
|
+
++r;
|
|
595
|
+
x = PowiainaNum.log(x, base);
|
|
596
|
+
}
|
|
592
597
|
}
|
|
593
|
-
|
|
598
|
+
if (x.gt(10)) return new PowiainaNum(r);
|
|
594
599
|
return PowiainaNum.NaN.clone();
|
|
595
600
|
}
|
|
596
601
|
}, {
|
|
@@ -630,6 +635,41 @@
|
|
|
630
635
|
value: function ln() {
|
|
631
636
|
return this.log();
|
|
632
637
|
}
|
|
638
|
+
/**
|
|
639
|
+
* plog10, beware unexpected errors.
|
|
640
|
+
*/
|
|
641
|
+
}, {
|
|
642
|
+
key: "plog10",
|
|
643
|
+
value: function plog10() {
|
|
644
|
+
return this.max(1).log10();
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* plog10, beware unexpected errors.
|
|
648
|
+
*/
|
|
649
|
+
}, {
|
|
650
|
+
key: "plog",
|
|
651
|
+
value:
|
|
652
|
+
/**
|
|
653
|
+
* plog, beware unexpected errors.
|
|
654
|
+
*/
|
|
655
|
+
function plog() {
|
|
656
|
+
var base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Math.E;
|
|
657
|
+
// log_a b = log_x b / log_x a;
|
|
658
|
+
var other = new PowiainaNum(base);
|
|
659
|
+
return this.plog10().div(other.plog10());
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* plog, beware unexpected errors.
|
|
663
|
+
*/
|
|
664
|
+
}, {
|
|
665
|
+
key: "pln",
|
|
666
|
+
value:
|
|
667
|
+
/**
|
|
668
|
+
* pln, beware unexpected errors.
|
|
669
|
+
*/
|
|
670
|
+
function pln() {
|
|
671
|
+
return this.plog();
|
|
672
|
+
}
|
|
633
673
|
}, {
|
|
634
674
|
key: "exp",
|
|
635
675
|
value: function exp() {
|
|
@@ -731,7 +771,7 @@
|
|
|
731
771
|
} else if (principal) {
|
|
732
772
|
if (this.abs().lt("1e-300")) return new PowiainaNum(this);else if (this.small) {
|
|
733
773
|
return PowiainaNum.fromNumber(f_lambertw(this.toNumber()));
|
|
734
|
-
} else if (this.
|
|
774
|
+
} else if (this.lt(MSI)) {
|
|
735
775
|
return PowiainaNum.fromNumber(f_lambertw(this.sign * this.getOperator(0)));
|
|
736
776
|
} else if (this.lt("eee15")) {
|
|
737
777
|
return d_lambertw(this);
|
|
@@ -775,7 +815,7 @@
|
|
|
775
815
|
return function (other2) {
|
|
776
816
|
var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
777
817
|
var other = new PowiainaNum(other2);
|
|
778
|
-
var ctt = PowiainaNum.arrowFuncMap.get("".concat(t.toString(), " ").concat(arrows.toString(), " ").concat(other.toString()));
|
|
818
|
+
var ctt = PowiainaNum.arrowFuncMap.get("".concat(t.toString(), " ").concat(arrows.toString(), " ").concat(other.toString(), " ").concat(depth));
|
|
779
819
|
if (ctt) return ctt.clone();
|
|
780
820
|
var res = function () {
|
|
781
821
|
var r;
|
|
@@ -788,12 +828,15 @@
|
|
|
788
828
|
if (t.eq(PowiainaNum.ONE)) return PowiainaNum.ONE.clone();
|
|
789
829
|
if (other.eq(PowiainaNum.ZERO)) return PowiainaNum.ONE.clone();
|
|
790
830
|
if (other.eq(PowiainaNum.ONE)) return t.clone();
|
|
831
|
+
// arrow > 9e15, that using 10{x}, x=arrow;
|
|
791
832
|
if (arrows.gt(PowiainaNum.MSI)) {
|
|
792
833
|
r = arrows.clone();
|
|
793
834
|
r.setOperator(r.getOperator(Infinity) + 1, Infinity);
|
|
794
835
|
return r;
|
|
795
836
|
}
|
|
796
837
|
var arrowsNum = arrows.toNumber();
|
|
838
|
+
// arrow < 9e15
|
|
839
|
+
// 10{x}2 = 10{x-1}10
|
|
797
840
|
if (other.eq(2)) return t.arrow(arrowsNum - 1)(t, depth + 1);
|
|
798
841
|
if (t.max(other).gt(PowiainaNum.arrowMSI(arrowsNum + 1))) return t.max(other);
|
|
799
842
|
if (t.gt(PowiainaNum.arrowMSI(arrowsNum)) || other.gt(MSI)) {
|
|
@@ -812,7 +855,12 @@
|
|
|
812
855
|
return j;
|
|
813
856
|
}
|
|
814
857
|
if (depth >= PowiainaNum.maxOps + 10) {
|
|
815
|
-
return new PowiainaNum(
|
|
858
|
+
return new PowiainaNum({
|
|
859
|
+
small: false,
|
|
860
|
+
sign: 1,
|
|
861
|
+
layer: 0,
|
|
862
|
+
array: [newOperator(10, 0), newOperator(1, arrowsNum)]
|
|
863
|
+
});
|
|
816
864
|
}
|
|
817
865
|
var y = other.toNumber();
|
|
818
866
|
var f = Math.floor(y);
|
|
@@ -830,7 +878,9 @@
|
|
|
830
878
|
r.normalize();
|
|
831
879
|
return r;
|
|
832
880
|
}();
|
|
833
|
-
|
|
881
|
+
if (depth < PowiainaNum.maxOps + 10) {
|
|
882
|
+
PowiainaNum.arrowFuncMap.set("".concat(t.toString(), " ").concat(arrows.toString(), " ").concat(other.toString(), " ").concat(depth), res.clone());
|
|
883
|
+
}
|
|
834
884
|
return res;
|
|
835
885
|
};
|
|
836
886
|
}
|
|
@@ -1441,6 +1491,17 @@
|
|
|
1441
1491
|
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Math.E;
|
|
1442
1492
|
return new PowiainaNum(t).log(base);
|
|
1443
1493
|
}
|
|
1494
|
+
}, {
|
|
1495
|
+
key: "plog10",
|
|
1496
|
+
value: function plog10(t) {
|
|
1497
|
+
return new PowiainaNum(t).plog10();
|
|
1498
|
+
}
|
|
1499
|
+
}, {
|
|
1500
|
+
key: "plog",
|
|
1501
|
+
value: function plog(t) {
|
|
1502
|
+
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Math.E;
|
|
1503
|
+
return new PowiainaNum(t).plog(base);
|
|
1504
|
+
}
|
|
1444
1505
|
}, {
|
|
1445
1506
|
key: "exp",
|
|
1446
1507
|
value: function exp(x) {
|
|
@@ -1564,7 +1625,7 @@
|
|
|
1564
1625
|
}, {
|
|
1565
1626
|
key: "arrowMSI",
|
|
1566
1627
|
value: function arrowMSI(arrowsNum) {
|
|
1567
|
-
return new PowiainaNum("10".concat(arrowsNum).concat(MSI));
|
|
1628
|
+
return new PowiainaNum("10{".concat(arrowsNum, "}").concat(MSI));
|
|
1568
1629
|
}
|
|
1569
1630
|
}, {
|
|
1570
1631
|
key: "fromNumber",
|