powiaina_num.js 0.2.8 → 0.2.10
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 +581 -252
- package/dist/PowiainaNum.esm.js +581 -252
- package/dist/PowiainaNum.js +581 -252
- package/dist/PowiainaNum.min.js +1 -1
- package/dist/index.d.ts +70 -18
- package/package.json +1 -1
package/dist/PowiainaNum.js
CHANGED
|
@@ -68,6 +68,8 @@
|
|
|
68
68
|
|
|
69
69
|
/* Author: VeryrrDefine 0.2.0-beta.1.1*/
|
|
70
70
|
var _a;
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region constants
|
|
71
73
|
var powiainaNumError = "[PowiainaNum 0.2 error]";
|
|
72
74
|
var MSI = 9007199254740991;
|
|
73
75
|
var MSI_LOG10 = 15.954589770191003;
|
|
@@ -75,6 +77,8 @@
|
|
|
75
77
|
var LONG_STRING_MIN_LENGTH = 17;
|
|
76
78
|
var EXP_E_REC = 1.444667861009766;
|
|
77
79
|
var isPowiainaNum = /^(PN)?[\/\-\+]*(Infinity|NaN|(P+|P\^\d+ )?(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+))$/;
|
|
80
|
+
var BE_REGEX = /^((\d+(\.\d*)?|\d*\.\d+)?([EeFf]([-\+]?)))*(0|\d+(\.\d*)?|\d*\.\d+)$/;
|
|
81
|
+
//#endregion
|
|
78
82
|
//#region some useful functions
|
|
79
83
|
function newOperator(r) {
|
|
80
84
|
var a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -88,6 +92,29 @@
|
|
|
88
92
|
valuereplaced: a == Infinity ? 0 : e == Infinity ? 1 : -1
|
|
89
93
|
};
|
|
90
94
|
}
|
|
95
|
+
function removeCommasOutsideBraces(input) {
|
|
96
|
+
var result = "";
|
|
97
|
+
var inBraces = false;
|
|
98
|
+
for (var i = 0; i < input.length; i++) {
|
|
99
|
+
var _char = input[i];
|
|
100
|
+
if (_char === "{") {
|
|
101
|
+
inBraces = true;
|
|
102
|
+
result += _char;
|
|
103
|
+
} else if (_char === "}") {
|
|
104
|
+
inBraces = false;
|
|
105
|
+
result += _char;
|
|
106
|
+
} else if (_char === ",") {
|
|
107
|
+
// 只有在花括号内部才保留逗号
|
|
108
|
+
if (inBraces) {
|
|
109
|
+
result += _char;
|
|
110
|
+
}
|
|
111
|
+
// 如果在花括号外部,就不添加到结果中(相当于删除)
|
|
112
|
+
} else {
|
|
113
|
+
result += _char;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
91
118
|
// parse 0.1.x PowiainaNum.js string
|
|
92
119
|
function parseLegacyPowiainaNumString(str) {
|
|
93
120
|
var pattern = /l(\d+)\s+s(\d+)\s+a(\[.*\])/;
|
|
@@ -120,7 +147,7 @@
|
|
|
120
147
|
function replaceETo10(str) {
|
|
121
148
|
// 使用正则表达式匹配 (e^数字) 的模式
|
|
122
149
|
// 正则解释:\(e\^(\d+)\) 匹配 (e^数字),其中 \d+ 匹配一个或多个数字
|
|
123
|
-
return str.replace(/\(e\^(\d+)\)/g, "(10^)^$1 ").replace(/(\d+)
|
|
150
|
+
return str.replace(/\(e\^(\d+)\)/g, "(10^)^$1 ").replace(/(\d+)[Pp][Tt]/g, "(10^)^$1 ");
|
|
124
151
|
}
|
|
125
152
|
/**
|
|
126
153
|
* 把一个字符串很长的数进行以10为底的对数
|
|
@@ -174,8 +201,10 @@
|
|
|
174
201
|
// The evaluation can become inaccurate very close to the branch point
|
|
175
202
|
// Evaluates W(x, 0) if principal is true, W(x, -1) if principal is false
|
|
176
203
|
function f_lambertw(z) {
|
|
177
|
-
var
|
|
178
|
-
var
|
|
204
|
+
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1e-10;
|
|
205
|
+
var pr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
206
|
+
var tol = t;
|
|
207
|
+
var principal = pr;
|
|
179
208
|
var w;
|
|
180
209
|
var wn;
|
|
181
210
|
if (!Number.isFinite(z)) {
|
|
@@ -338,16 +367,26 @@
|
|
|
338
367
|
this.small = false;
|
|
339
368
|
this.sign = 0;
|
|
340
369
|
this.layer = 0;
|
|
341
|
-
if (
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
370
|
+
if (PowiainaNum.blankArgumentConstructorReturnZero) {
|
|
371
|
+
this.resetFromObject(PowiainaNum.ZERO);
|
|
372
|
+
}
|
|
373
|
+
try {
|
|
374
|
+
if (typeof arg1 == "undefined") {} else if (typeof arg1 == "number") {
|
|
375
|
+
var obj = PowiainaNum.fromNumber(arg1);
|
|
376
|
+
this.resetFromObject(obj);
|
|
377
|
+
} else if (_typeof(arg1) == "object") {
|
|
378
|
+
var _obj = PowiainaNum.fromObject(arg1);
|
|
379
|
+
this.resetFromObject(_obj);
|
|
380
|
+
} else if (typeof arg1 == "string") {
|
|
381
|
+
var _obj2 = PowiainaNum.fromString(arg1);
|
|
382
|
+
this.resetFromObject(_obj2);
|
|
383
|
+
} else {
|
|
384
|
+
var isn = arg1;
|
|
385
|
+
}
|
|
386
|
+
} catch (e) {
|
|
387
|
+
console.error("Malformed input");
|
|
388
|
+
console.error(e);
|
|
389
|
+
}
|
|
351
390
|
}
|
|
352
391
|
//#region 4 Basic calculates.
|
|
353
392
|
/**
|
|
@@ -358,7 +397,7 @@
|
|
|
358
397
|
key: "add",
|
|
359
398
|
value: function add(other) {
|
|
360
399
|
var _b, _c, _d, _e;
|
|
361
|
-
var x = this.clone();
|
|
400
|
+
var x = this.clone().normalize();
|
|
362
401
|
var y = new PowiainaNum(other);
|
|
363
402
|
// inf + -inf = nan
|
|
364
403
|
if (x.eq(PowiainaNum.POSITIVE_INFINITY) && y.eq(PowiainaNum.NEGATIVE_INFINITY) || x.eq(PowiainaNum.NEGATIVE_INFINITY) && y.eq(PowiainaNum.POSITIVE_INFINITY)) return PowiainaNum.NaN.clone();
|
|
@@ -419,7 +458,7 @@
|
|
|
419
458
|
mult *= -1;
|
|
420
459
|
}
|
|
421
460
|
if (t == 0) throw Error("Encounter a calculate error");
|
|
422
|
-
r =
|
|
461
|
+
r = PowiainaNum.NaN.clone();
|
|
423
462
|
r.sign = 1;
|
|
424
463
|
if (l > MSI_LOG10 || l < -MSI_LOG10) {
|
|
425
464
|
r.array = [newOperator(l, 0), newOperator(1, 1)];
|
|
@@ -430,11 +469,21 @@
|
|
|
430
469
|
r.sign *= mult;
|
|
431
470
|
return r;
|
|
432
471
|
}
|
|
472
|
+
}, {
|
|
473
|
+
key: "plus",
|
|
474
|
+
value: function plus(other) {
|
|
475
|
+
return this.add(other);
|
|
476
|
+
}
|
|
433
477
|
}, {
|
|
434
478
|
key: "sub",
|
|
435
479
|
value: function sub(a) {
|
|
436
480
|
return this.add(new PowiainaNum(a).neg());
|
|
437
481
|
}
|
|
482
|
+
}, {
|
|
483
|
+
key: "minus",
|
|
484
|
+
value: function minus(other) {
|
|
485
|
+
return this.sub(other);
|
|
486
|
+
}
|
|
438
487
|
}, {
|
|
439
488
|
key: "mul",
|
|
440
489
|
value: function mul(other) {
|
|
@@ -468,12 +517,22 @@
|
|
|
468
517
|
r.sign = x.sign * y.sign;
|
|
469
518
|
return r;
|
|
470
519
|
}
|
|
520
|
+
}, {
|
|
521
|
+
key: "times",
|
|
522
|
+
value: function times(other) {
|
|
523
|
+
return this.mul(other);
|
|
524
|
+
}
|
|
471
525
|
}, {
|
|
472
526
|
key: "div",
|
|
473
527
|
value: function div(other) {
|
|
474
528
|
var x = new PowiainaNum(other).rec();
|
|
475
529
|
return this.mul(x);
|
|
476
530
|
}
|
|
531
|
+
}, {
|
|
532
|
+
key: "divide",
|
|
533
|
+
value: function divide(other) {
|
|
534
|
+
return this.div(other);
|
|
535
|
+
}
|
|
477
536
|
}, {
|
|
478
537
|
key: "mod",
|
|
479
538
|
value: function mod(x) {
|
|
@@ -481,14 +540,20 @@
|
|
|
481
540
|
var division = this.div(other);
|
|
482
541
|
return division.sub(division.floor()).mul(other);
|
|
483
542
|
}
|
|
543
|
+
}, {
|
|
544
|
+
key: "modulus",
|
|
545
|
+
value: function modulus(x) {
|
|
546
|
+
return this.mod(x);
|
|
547
|
+
}
|
|
548
|
+
}, {
|
|
549
|
+
key: "pow10",
|
|
550
|
+
value:
|
|
484
551
|
//#endregion
|
|
485
552
|
//#region power
|
|
486
553
|
/**
|
|
487
554
|
* @returns 10 to the power of `this`
|
|
488
555
|
*/
|
|
489
|
-
|
|
490
|
-
key: "pow10",
|
|
491
|
-
value: function pow10() {
|
|
556
|
+
function pow10() {
|
|
492
557
|
var _b, _c;
|
|
493
558
|
var r = this.clone();
|
|
494
559
|
// inf & nan check
|
|
@@ -518,8 +583,16 @@
|
|
|
518
583
|
if (!other.isFinite()) return other.clone();
|
|
519
584
|
if (!this.isFinite()) return this.clone();
|
|
520
585
|
if (this.eq(10)) return other.pow10();
|
|
586
|
+
if (other.isneg()) return this.pow(other.neg()).rec();
|
|
521
587
|
if (this.isneg()) {
|
|
522
|
-
if (!other.isInt())
|
|
588
|
+
if (!other.isInt()) {
|
|
589
|
+
if (other.small) {
|
|
590
|
+
if (other.rec().div(2).eq(1)) {
|
|
591
|
+
return this.neg().pow(other).neg();
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
return PowiainaNum.NaN.clone();
|
|
595
|
+
}
|
|
523
596
|
var r = this.abs().pow(other);
|
|
524
597
|
r.sign = function () {
|
|
525
598
|
var a = other.mod(2).round();
|
|
@@ -596,6 +669,16 @@
|
|
|
596
669
|
var other = new PowiainaNum(base);
|
|
597
670
|
return this.log10().div(other.log10());
|
|
598
671
|
}
|
|
672
|
+
}, {
|
|
673
|
+
key: "log2",
|
|
674
|
+
value: function log2() {
|
|
675
|
+
return this.log(2);
|
|
676
|
+
}
|
|
677
|
+
}, {
|
|
678
|
+
key: "logBase",
|
|
679
|
+
value: function logBase(a) {
|
|
680
|
+
return this.log(a);
|
|
681
|
+
}
|
|
599
682
|
}, {
|
|
600
683
|
key: "ln",
|
|
601
684
|
value: function ln() {
|
|
@@ -703,7 +786,8 @@
|
|
|
703
786
|
//Code from break_eternity.js
|
|
704
787
|
//Some special values, for testing: https://en.wikipedia.org/wiki/Lambert_W_function#Special_values
|
|
705
788
|
function lambertw() {
|
|
706
|
-
var
|
|
789
|
+
var princ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
790
|
+
var principal = princ;
|
|
707
791
|
if (this.lt(-0.3678794411710499)) {
|
|
708
792
|
return PowiainaNum.NaN.clone(); //complex
|
|
709
793
|
} else if (principal) {
|
|
@@ -721,9 +805,9 @@
|
|
|
721
805
|
if (this.sign === 1) {
|
|
722
806
|
return PowiainaNum.NaN.clone(); //complex
|
|
723
807
|
}
|
|
724
|
-
if (this.
|
|
808
|
+
if (this.lt(9e15)) {
|
|
725
809
|
return PowiainaNum.fromNumber(f_lambertw(this.sign * this.array[0].repeat, 1e-10, false));
|
|
726
|
-
} else if (this.
|
|
810
|
+
} else if (this.lt(PowiainaNum.E_MSI)) {
|
|
727
811
|
return d_lambertw(this, 1e-10, false);
|
|
728
812
|
} else {
|
|
729
813
|
return this.neg().rec().lambertw().neg();
|
|
@@ -744,7 +828,9 @@
|
|
|
744
828
|
var payl = new PowiainaNum(payload);
|
|
745
829
|
if (t.isNaN() || other.isNaN() || payl.isNaN()) return PowiainaNum.NaN.clone();
|
|
746
830
|
if (t.eq(1)) return PowiainaNum.ONE.clone();
|
|
747
|
-
if (payl.neq(PowiainaNum.ONE)
|
|
831
|
+
if (payl.neq(PowiainaNum.ONE) && t.gte(EXP_E_REC)) {
|
|
832
|
+
other = other.add(payl.slog(t));
|
|
833
|
+
}
|
|
748
834
|
var negln;
|
|
749
835
|
if (other.isInfi() && other.sign > 0) {
|
|
750
836
|
if (t.gte(EXP_E_REC)) return PowiainaNum.POSITIVE_INFINITY.clone();
|
|
@@ -1074,9 +1160,9 @@
|
|
|
1074
1160
|
// base^base^... = x? (? bases)
|
|
1075
1161
|
var r = 0;
|
|
1076
1162
|
// 计算x与base的差距
|
|
1077
|
-
var
|
|
1078
|
-
if (
|
|
1079
|
-
var l =
|
|
1163
|
+
var distanceLayerOf = x.getOperator(arrowsNum) - b.getOperator(arrowsNum);
|
|
1164
|
+
if (distanceLayerOf > 3) {
|
|
1165
|
+
var l = distanceLayerOf - 3;
|
|
1080
1166
|
r += l;
|
|
1081
1167
|
x.setOperator(x.getOperator(arrowsNum) - l, arrowsNum);
|
|
1082
1168
|
}
|
|
@@ -1118,18 +1204,18 @@
|
|
|
1118
1204
|
}
|
|
1119
1205
|
}, {
|
|
1120
1206
|
key: "pentate",
|
|
1121
|
-
value: function pentate(other) {
|
|
1122
|
-
return this.arrow(3)(other);
|
|
1207
|
+
value: function pentate(other, payload) {
|
|
1208
|
+
return this.arrow(3)(other, payload);
|
|
1123
1209
|
}
|
|
1124
1210
|
}, {
|
|
1125
1211
|
key: "hexate",
|
|
1126
|
-
value: function hexate(other) {
|
|
1127
|
-
return this.arrow(4)(other);
|
|
1212
|
+
value: function hexate(other, payload) {
|
|
1213
|
+
return this.arrow(4)(other, payload);
|
|
1128
1214
|
}
|
|
1129
1215
|
}, {
|
|
1130
1216
|
key: "pent",
|
|
1131
|
-
value: function pent(other) {
|
|
1132
|
-
return this.arrow(3)(other);
|
|
1217
|
+
value: function pent(other, payload) {
|
|
1218
|
+
return this.arrow(3)(other, payload);
|
|
1133
1219
|
}
|
|
1134
1220
|
}, {
|
|
1135
1221
|
key: "penta_log",
|
|
@@ -1137,6 +1223,9 @@
|
|
|
1137
1223
|
var base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
|
1138
1224
|
return this.anyarrow_log(3)(base);
|
|
1139
1225
|
}
|
|
1226
|
+
}, {
|
|
1227
|
+
key: "expansion",
|
|
1228
|
+
value:
|
|
1140
1229
|
/**
|
|
1141
1230
|
* Expansion, which is `this`{{1}}`other2`.
|
|
1142
1231
|
*
|
|
@@ -1144,9 +1233,7 @@
|
|
|
1144
1233
|
*
|
|
1145
1234
|
* @url https://googology.fandom.com/wiki/Expansion
|
|
1146
1235
|
*/
|
|
1147
|
-
|
|
1148
|
-
key: "expansion",
|
|
1149
|
-
value: function expansion(other2) {
|
|
1236
|
+
function expansion(other2) {
|
|
1150
1237
|
var other = new PowiainaNum(other2);
|
|
1151
1238
|
var t = this.clone();
|
|
1152
1239
|
if (other.lt(PowiainaNum.ZERO) || !other.isInt()) return PowiainaNum.NaN.clone();
|
|
@@ -1459,6 +1546,16 @@
|
|
|
1459
1546
|
var t = this.cmp(other);
|
|
1460
1547
|
return t == 0 || t == 1;
|
|
1461
1548
|
}
|
|
1549
|
+
}, {
|
|
1550
|
+
key: "equals",
|
|
1551
|
+
value: function equals(other) {
|
|
1552
|
+
return this.eq(other);
|
|
1553
|
+
}
|
|
1554
|
+
}, {
|
|
1555
|
+
key: "notEquals",
|
|
1556
|
+
value: function notEquals(other) {
|
|
1557
|
+
return this.neq(other);
|
|
1558
|
+
}
|
|
1462
1559
|
}, {
|
|
1463
1560
|
key: "eq_tolerance",
|
|
1464
1561
|
value: function eq_tolerance(value) {
|
|
@@ -1520,6 +1617,16 @@
|
|
|
1520
1617
|
a.small = !a.small;
|
|
1521
1618
|
return a;
|
|
1522
1619
|
}
|
|
1620
|
+
}, {
|
|
1621
|
+
key: "recip",
|
|
1622
|
+
value: function recip() {
|
|
1623
|
+
return this.rec();
|
|
1624
|
+
}
|
|
1625
|
+
}, {
|
|
1626
|
+
key: "reciprocate",
|
|
1627
|
+
value: function reciprocate() {
|
|
1628
|
+
return this.rec();
|
|
1629
|
+
}
|
|
1523
1630
|
}, {
|
|
1524
1631
|
key: "floor",
|
|
1525
1632
|
value: function floor() {
|
|
@@ -1560,6 +1667,9 @@
|
|
|
1560
1667
|
r.sign = this.sign;
|
|
1561
1668
|
return r;
|
|
1562
1669
|
}
|
|
1670
|
+
}, {
|
|
1671
|
+
key: "trunc",
|
|
1672
|
+
value:
|
|
1563
1673
|
/**
|
|
1564
1674
|
* Work like `Math.trunc`,
|
|
1565
1675
|
*
|
|
@@ -1572,15 +1682,10 @@
|
|
|
1572
1682
|
* new PowiainaNum(-1.114514).trunc() == new PowiainaNum(-1)
|
|
1573
1683
|
* @returns
|
|
1574
1684
|
*/
|
|
1575
|
-
|
|
1576
|
-
key: "trunc",
|
|
1577
|
-
value: function trunc() {
|
|
1685
|
+
function trunc() {
|
|
1578
1686
|
var y = this.clone();
|
|
1579
1687
|
return y.gte(0) ? y.floor() : y.ceil();
|
|
1580
1688
|
}
|
|
1581
|
-
/**
|
|
1582
|
-
* @returns if this<other, return -1, if this=other, return 0, if this>other, return 1, if this!<=>, return 2
|
|
1583
|
-
*/
|
|
1584
1689
|
}, {
|
|
1585
1690
|
key: "isNaN",
|
|
1586
1691
|
value: function (_isNaN) {
|
|
@@ -1643,10 +1748,164 @@
|
|
|
1643
1748
|
value: function isneg() {
|
|
1644
1749
|
return this.sign < 0;
|
|
1645
1750
|
}
|
|
1751
|
+
}, {
|
|
1752
|
+
key: "getOperatorIndex",
|
|
1753
|
+
value:
|
|
1754
|
+
//#endregion
|
|
1755
|
+
//#region operators
|
|
1756
|
+
/**
|
|
1757
|
+
* @returns number will return the index of the operator in array. return as x.5 if it's between the xth and x+1th operators.
|
|
1758
|
+
*/
|
|
1759
|
+
function getOperatorIndex(arrow) {
|
|
1760
|
+
var expans = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
1761
|
+
var megota = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1762
|
+
for (var i = 0; i < this.array.length; i++) {
|
|
1763
|
+
var cmp = compareTuples([this.array[i].megota, this.array[i].expans, this.array[i].arrow], [megota, expans, arrow]);
|
|
1764
|
+
if (cmp == 0) return i; // I find it was [xx,xxx,*xxx*,xxx]!
|
|
1765
|
+
if (cmp == 1) return i - 0.5; // It's between [xx, xx,xx*,?,*xx]!
|
|
1766
|
+
}
|
|
1767
|
+
return this.array.length - 0.5;
|
|
1768
|
+
}
|
|
1769
|
+
/**
|
|
1770
|
+
* @returns number repeats of operators with given arguments.
|
|
1771
|
+
*/
|
|
1772
|
+
}, {
|
|
1773
|
+
key: "getOperator",
|
|
1774
|
+
value: function getOperator(arrow) {
|
|
1775
|
+
var expans = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
1776
|
+
var megota = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1777
|
+
var index = this.getOperatorIndex(arrow, expans, megota);
|
|
1778
|
+
if (!this.array[index]) return 0;
|
|
1779
|
+
return this.array[index].repeat;
|
|
1780
|
+
}
|
|
1781
|
+
/**
|
|
1782
|
+
* Modify the repeat of operator
|
|
1783
|
+
* @param number val the repeat of operator will modify to array.
|
|
1784
|
+
* @returns bool Is the operators array changed?
|
|
1785
|
+
*/
|
|
1786
|
+
}, {
|
|
1787
|
+
key: "setOperator",
|
|
1788
|
+
value: function setOperator(val, arrow) {
|
|
1789
|
+
var expans = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1790
|
+
var megota = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
1791
|
+
// if (arrow!=0&&val==0) return false;
|
|
1792
|
+
var index = this.getOperatorIndex(arrow, expans, megota);
|
|
1793
|
+
if (!this.array[index]) {
|
|
1794
|
+
this.array.splice(Math.ceil(index), 0, {
|
|
1795
|
+
arrow: arrow,
|
|
1796
|
+
expans: expans,
|
|
1797
|
+
megota: megota,
|
|
1798
|
+
valuereplaced: expans === Infinity ? 1 : arrow == Infinity ? 0 : -1,
|
|
1799
|
+
repeat: val
|
|
1800
|
+
});
|
|
1801
|
+
return true;
|
|
1802
|
+
}
|
|
1803
|
+
this.array[index].repeat = val;
|
|
1804
|
+
// this.normalize()
|
|
1805
|
+
return false;
|
|
1806
|
+
}
|
|
1807
|
+
//#endregion
|
|
1808
|
+
//#region converters
|
|
1809
|
+
/**
|
|
1810
|
+
* Convert `this` to Javascript `number`
|
|
1811
|
+
*
|
|
1812
|
+
* returns `Infinity` when the number is greater than `Number.MAX_VALUE`
|
|
1813
|
+
*/
|
|
1814
|
+
}, {
|
|
1815
|
+
key: "toNumber",
|
|
1816
|
+
value: function toNumber() {
|
|
1817
|
+
if (this.sign == -1) return -this.neg().toNumber();
|
|
1818
|
+
if (this.small) return 1 / this.rec().toNumber();
|
|
1819
|
+
if (this.array.length > 2) return Infinity;
|
|
1820
|
+
if (this.array.length == 1) return this.array[0].repeat;else if (this.array.length == 2 && this.array[1].arrow == 1 && this.array[1].expans == 1 && this.array[1].megota == 1 && this.array[1].repeat == 1) return Math.pow(10, this.getOperator(0));
|
|
1821
|
+
return NaN;
|
|
1822
|
+
}
|
|
1823
|
+
/**
|
|
1824
|
+
* Convert `this` to a string
|
|
1825
|
+
*/
|
|
1826
|
+
}, {
|
|
1827
|
+
key: "toString_core",
|
|
1828
|
+
value: function toString_core() {
|
|
1829
|
+
if (this.isNaN()) return "NaN";
|
|
1830
|
+
if (this.sign == -1) return "-".concat(this.neg().toString());
|
|
1831
|
+
if (this.small) {
|
|
1832
|
+
if (this.isZero()) return "0";
|
|
1833
|
+
return "/".concat(this.rec().toString());
|
|
1834
|
+
}
|
|
1835
|
+
if (this.isInfi()) return "Infinity";
|
|
1836
|
+
// P^a (10{arrow,expans,megota})^repeation base
|
|
1837
|
+
var res = "";
|
|
1838
|
+
if (!this.layer) res += "";else if (this.layer < 3) res += "P".repeat(this.layer);else res += "P^" + this.layer + " ";
|
|
1839
|
+
for (var i = this.array.length - 1; i >= 0; i--) {
|
|
1840
|
+
var oper = this.array[i];
|
|
1841
|
+
var calc = "10{".concat(oper.arrow === Infinity ? "!" : oper.arrow).concat(oper.expans > 1 || oper.megota > 1 ? ",".concat(oper.expans === Infinity ? "!" : oper.expans) : "").concat(oper.megota > 1 ? ",".concat(oper.megota) : "", "}");
|
|
1842
|
+
if (oper.arrow == 1 && oper.expans == 1 && oper.megota == 1 && oper.repeat < 5) {
|
|
1843
|
+
calc = "e".repeat(oper.repeat);
|
|
1844
|
+
} else if (oper.arrow == 0 && oper.expans == 1 && oper.megota == 1) {
|
|
1845
|
+
calc = oper.repeat.toString();
|
|
1846
|
+
} else if (oper.repeat > 1) {
|
|
1847
|
+
calc = "(".concat(calc, ")^").concat(oper.repeat, " ");
|
|
1848
|
+
} else {
|
|
1849
|
+
calc = "".concat(calc);
|
|
1850
|
+
}
|
|
1851
|
+
res += "".concat(calc);
|
|
1852
|
+
}
|
|
1853
|
+
return res;
|
|
1854
|
+
}
|
|
1855
|
+
}, {
|
|
1856
|
+
key: "toString",
|
|
1857
|
+
value: function toString() {
|
|
1858
|
+
try {
|
|
1859
|
+
return this.toString_core();
|
|
1860
|
+
} catch (_b) {
|
|
1861
|
+
console.error("Checked error when converting to string");
|
|
1862
|
+
return "NaN";
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
}, {
|
|
1866
|
+
key: "toJSON",
|
|
1867
|
+
value:
|
|
1868
|
+
/**
|
|
1869
|
+
* Convert `this` to a JSON object
|
|
1870
|
+
* @returns a JSON object
|
|
1871
|
+
*/
|
|
1872
|
+
function toJSON() {
|
|
1873
|
+
return "PN" + this.toString();
|
|
1874
|
+
}
|
|
1875
|
+
}, {
|
|
1876
|
+
key: "arr01",
|
|
1877
|
+
get:
|
|
1878
|
+
/**
|
|
1879
|
+
* A property array value for version 0.1.x PowiainaNum.
|
|
1880
|
+
*/
|
|
1881
|
+
function get() {
|
|
1882
|
+
var res = [0];
|
|
1883
|
+
for (var i = 0; i < this.array.length; i++) {
|
|
1884
|
+
if (i == 0) res[0] = this.array[i].repeat;else {
|
|
1885
|
+
// @ts-ignore
|
|
1886
|
+
res[i] = [0, 0, 0, 0];
|
|
1887
|
+
// @ts-ignore
|
|
1888
|
+
res[i][0] = this.array[i].arrow == Infinity ? "x" : this.array[i].arrow;
|
|
1889
|
+
// @ts-ignore
|
|
1890
|
+
res[i][1] = this.array[i].repeat;
|
|
1891
|
+
// @ts-ignore
|
|
1892
|
+
res[i][2] = this.array[i].expans == Infinity ? "x" : this.array[i].expans;
|
|
1893
|
+
// @ts-ignore
|
|
1894
|
+
res[i][3] = this.array[i].megota;
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
return res;
|
|
1898
|
+
}
|
|
1899
|
+
//#endregion
|
|
1900
|
+
//#region useless functions
|
|
1901
|
+
/**
|
|
1902
|
+
* This function is for NaNe308, if you want to calculate G(x), use this function directly.
|
|
1903
|
+
*/
|
|
1646
1904
|
}, {
|
|
1647
1905
|
key: "normalize",
|
|
1648
1906
|
value:
|
|
1649
1907
|
//#endregion
|
|
1908
|
+
//#region other functions
|
|
1650
1909
|
/**
|
|
1651
1910
|
* Normalize functions will make this number convert into standard format.(it also change `this`, like [].sort)
|
|
1652
1911
|
* @returns normalized number
|
|
@@ -1655,9 +1914,14 @@
|
|
|
1655
1914
|
//TODO: normalize
|
|
1656
1915
|
var renormalize = true;
|
|
1657
1916
|
var x = this;
|
|
1658
|
-
|
|
1917
|
+
if (this.array === undefined) {
|
|
1918
|
+
x.array = [newOperator(NaN, 0, 1, 1)];
|
|
1919
|
+
}
|
|
1920
|
+
if (this.sign === undefined) this.sign = 0;
|
|
1921
|
+
if (this.layer === undefined) this.layer = 0;
|
|
1922
|
+
for (var i = 0; i < this.array.length; i++) {
|
|
1659
1923
|
// Check what is infinity
|
|
1660
|
-
if (this.array[
|
|
1924
|
+
if (this.array[i].repeat == Infinity) {
|
|
1661
1925
|
this.array = [{
|
|
1662
1926
|
arrow: 0,
|
|
1663
1927
|
expans: 1,
|
|
@@ -1668,8 +1932,8 @@
|
|
|
1668
1932
|
return this;
|
|
1669
1933
|
}
|
|
1670
1934
|
}
|
|
1671
|
-
for (var
|
|
1672
|
-
var e = x.array[
|
|
1935
|
+
for (var _i = 1; _i < x.array.length; ++_i) {
|
|
1936
|
+
var e = x.array[_i];
|
|
1673
1937
|
if (e.arrow === null || e.arrow === undefined) {
|
|
1674
1938
|
e.arrow = 0;
|
|
1675
1939
|
}
|
|
@@ -1700,28 +1964,28 @@
|
|
|
1700
1964
|
renormalize = false;
|
|
1701
1965
|
// Sort arrays.
|
|
1702
1966
|
this.array.sort(arraySortFunction);
|
|
1703
|
-
for (
|
|
1704
|
-
if (x.array[
|
|
1967
|
+
for (var _i2 = 1; _i2 < x.array.length - 1; ++_i2) {
|
|
1968
|
+
if (x.array[_i2].arrow == x.array[_i2 + 1].arrow && x.array[_i2].expans == x.array[_i2 + 1].expans && x.array[_i2].megota == x.array[_i2 + 1].megota) {
|
|
1705
1969
|
// same array's merge
|
|
1706
|
-
x.array[
|
|
1707
|
-
x.array.splice(
|
|
1708
|
-
--
|
|
1970
|
+
x.array[_i2].repeat += x.array[_i2 + 1].repeat;
|
|
1971
|
+
x.array.splice(_i2 + 1, 1);
|
|
1972
|
+
--_i2;
|
|
1709
1973
|
renormalize = true;
|
|
1710
1974
|
}
|
|
1711
1975
|
}
|
|
1712
|
-
for (
|
|
1976
|
+
for (var _i3 = 1; _i3 < x.array.length; ++_i3) {
|
|
1713
1977
|
// If there is a 0 repeat operator, remove it.
|
|
1714
|
-
if (x.array[
|
|
1715
|
-
x.array.splice(
|
|
1716
|
-
--
|
|
1978
|
+
if (x.array[_i3].arrow !== 0 && (x.array[_i3].repeat === 0 || x.array[_i3].repeat === null || x.array[_i3].repeat === undefined)) {
|
|
1979
|
+
x.array.splice(_i3, 1);
|
|
1980
|
+
--_i3;
|
|
1717
1981
|
continue;
|
|
1718
1982
|
}
|
|
1719
1983
|
// If there is a operator which arrow 0 and brace count >=2
|
|
1720
1984
|
// replace it as arrow replacement operaotr
|
|
1721
|
-
if (x.array[
|
|
1722
|
-
x.array[
|
|
1723
|
-
x.array[
|
|
1724
|
-
x.array[
|
|
1985
|
+
if (x.array[_i3].arrow == 0 && x.array[_i3].expans >= 2) {
|
|
1986
|
+
x.array[_i3].arrow = Infinity;
|
|
1987
|
+
x.array[_i3].valuereplaced = 0;
|
|
1988
|
+
x.array[_i3].expans = x.array[_i3].expans - 1;
|
|
1725
1989
|
}
|
|
1726
1990
|
}
|
|
1727
1991
|
if (x.array.length > PowiainaNum.maxOps) x.array.splice(1, x.array.length - PowiainaNum.maxOps); // max operators check
|
|
@@ -1751,6 +2015,11 @@
|
|
|
1751
2015
|
this.small = !this.small;
|
|
1752
2016
|
renormalize = true;
|
|
1753
2017
|
}
|
|
2018
|
+
// for a = 1, small should false.
|
|
2019
|
+
if (this.array.length == 1 && this.array[0].repeat == 1 && this.small) {
|
|
2020
|
+
this.small = false;
|
|
2021
|
+
renormalize = true;
|
|
2022
|
+
}
|
|
1754
2023
|
// for any 10{X>9e15}10, replace into 10{!}X;
|
|
1755
2024
|
if (this.array.length >= 2 && this.array[1].arrow >= MSI) {
|
|
1756
2025
|
this.array[0].repeat = this.array[1].arrow;
|
|
@@ -1806,61 +2075,6 @@
|
|
|
1806
2075
|
} while (renormalize);
|
|
1807
2076
|
return this;
|
|
1808
2077
|
}
|
|
1809
|
-
//#region operators
|
|
1810
|
-
/**
|
|
1811
|
-
* @returns number will return the index of the operator in array. return as x.5 if it's between the xth and x+1th operators.
|
|
1812
|
-
*/
|
|
1813
|
-
}, {
|
|
1814
|
-
key: "getOperatorIndex",
|
|
1815
|
-
value: function getOperatorIndex(arrow) {
|
|
1816
|
-
var expans = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
1817
|
-
var megota = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1818
|
-
for (var i = 0; i < this.array.length; i++) {
|
|
1819
|
-
var cmp = compareTuples([this.array[i].megota, this.array[i].expans, this.array[i].arrow], [megota, expans, arrow]);
|
|
1820
|
-
if (cmp == 0) return i; // I find it was [xx,xxx,*xxx*,xxx]!
|
|
1821
|
-
if (cmp == 1) return i - 0.5; // It's between [xx, xx,xx*,?,*xx]!
|
|
1822
|
-
}
|
|
1823
|
-
return this.array.length - 0.5;
|
|
1824
|
-
}
|
|
1825
|
-
/**
|
|
1826
|
-
* @returns number repeats of operators with given arguments.
|
|
1827
|
-
*/
|
|
1828
|
-
}, {
|
|
1829
|
-
key: "getOperator",
|
|
1830
|
-
value: function getOperator(arrow) {
|
|
1831
|
-
var expans = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
1832
|
-
var megota = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1833
|
-
var index = this.getOperatorIndex(arrow, expans, megota);
|
|
1834
|
-
if (!this.array[index]) return 0;
|
|
1835
|
-
return this.array[index].repeat;
|
|
1836
|
-
}
|
|
1837
|
-
/**
|
|
1838
|
-
* Modify the repeat of operator
|
|
1839
|
-
* @param number val the repeat of operator will modify to array.
|
|
1840
|
-
* @returns bool Is the operators array changed?
|
|
1841
|
-
*/
|
|
1842
|
-
}, {
|
|
1843
|
-
key: "setOperator",
|
|
1844
|
-
value: function setOperator(val, arrow) {
|
|
1845
|
-
var expans = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1846
|
-
var megota = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
1847
|
-
// if (arrow!=0&&val==0) return false;
|
|
1848
|
-
var index = this.getOperatorIndex(arrow, expans, megota);
|
|
1849
|
-
if (!this.array[index]) {
|
|
1850
|
-
this.array.splice(Math.ceil(index), 0, {
|
|
1851
|
-
arrow: arrow,
|
|
1852
|
-
expans: expans,
|
|
1853
|
-
megota: megota,
|
|
1854
|
-
valuereplaced: expans === Infinity ? 1 : arrow == Infinity ? 0 : -1,
|
|
1855
|
-
repeat: val
|
|
1856
|
-
});
|
|
1857
|
-
return true;
|
|
1858
|
-
}
|
|
1859
|
-
this.array[index].repeat = val;
|
|
1860
|
-
// this.normalize()
|
|
1861
|
-
return false;
|
|
1862
|
-
}
|
|
1863
|
-
//#endregion
|
|
1864
2078
|
/**
|
|
1865
2079
|
* @returns a PowiainaNum object which deep copied from `this` object.
|
|
1866
2080
|
*/
|
|
@@ -1879,6 +2093,9 @@
|
|
|
1879
2093
|
}, {
|
|
1880
2094
|
key: "resetFromObject",
|
|
1881
2095
|
value: function resetFromObject(powlikeObject) {
|
|
2096
|
+
if (!powlikeObject.array) {
|
|
2097
|
+
return;
|
|
2098
|
+
}
|
|
1882
2099
|
this.array = [];
|
|
1883
2100
|
for (var i = 0; i < powlikeObject.array.length; i++) {
|
|
1884
2101
|
this.array[i] = {
|
|
@@ -1894,107 +2111,56 @@
|
|
|
1894
2111
|
this.layer = powlikeObject.layer;
|
|
1895
2112
|
return this;
|
|
1896
2113
|
}
|
|
1897
|
-
//#region converters
|
|
1898
|
-
/**
|
|
1899
|
-
* Convert `this` to Javascript `number`
|
|
1900
|
-
*
|
|
1901
|
-
* returns `Infinity` when the number is greater than `Number.MAX_VALUE`
|
|
1902
|
-
*/
|
|
1903
|
-
}, {
|
|
1904
|
-
key: "toNumber",
|
|
1905
|
-
value: function toNumber() {
|
|
1906
|
-
if (this.sign == -1) return -this.neg().toNumber();
|
|
1907
|
-
if (this.small) return 1 / this.rec().toNumber();
|
|
1908
|
-
if (this.array.length > 2) return Infinity;
|
|
1909
|
-
if (this.array.length == 1) return this.array[0].repeat;else if (this.array.length == 2 && this.array[1].arrow == 1 && this.array[1].expans == 1 && this.array[1].megota == 1 && this.array[1].repeat == 1) return Math.pow(10, this.getOperator(0));
|
|
1910
|
-
return NaN;
|
|
1911
|
-
}
|
|
1912
|
-
/**
|
|
1913
|
-
* Convert `this` to a string
|
|
1914
|
-
*/
|
|
1915
|
-
}, {
|
|
1916
|
-
key: "toString",
|
|
1917
|
-
value: function toString() {
|
|
1918
|
-
if (this.isNaN()) return "NaN";
|
|
1919
|
-
if (this.sign == -1) return "-".concat(this.neg().toString());
|
|
1920
|
-
if (this.small) {
|
|
1921
|
-
if (this.isZero()) return "0";
|
|
1922
|
-
return "/".concat(this.rec().toString());
|
|
1923
|
-
}
|
|
1924
|
-
if (this.isInfi()) return "Infinity";
|
|
1925
|
-
// P^a (10{arrow,expans,megota})^repeation base
|
|
1926
|
-
var res = "";
|
|
1927
|
-
if (!this.layer) res += "";else if (this.layer < 3) res += "P".repeat(this.layer);else res += "P^" + this.layer + " ";
|
|
1928
|
-
for (var i = this.array.length - 1; i >= 0; i--) {
|
|
1929
|
-
var oper = this.array[i];
|
|
1930
|
-
var calc = "10{".concat(oper.arrow === Infinity ? "!" : oper.arrow).concat(oper.expans > 1 || oper.megota > 1 ? ",".concat(oper.expans === Infinity ? "!" : oper.expans) : "").concat(oper.megota > 1 ? ",".concat(oper.megota) : "", "}");
|
|
1931
|
-
if (oper.arrow == 1 && oper.expans == 1 && oper.megota == 1 && oper.repeat < 5) {
|
|
1932
|
-
calc = "e".repeat(oper.repeat);
|
|
1933
|
-
} else if (oper.arrow == 0 && oper.expans == 1 && oper.megota == 1) {
|
|
1934
|
-
calc = oper.repeat.toString();
|
|
1935
|
-
} else if (oper.repeat > 1) {
|
|
1936
|
-
calc = "(".concat(calc, ")^").concat(oper.repeat, " ");
|
|
1937
|
-
} else {
|
|
1938
|
-
calc = "".concat(calc);
|
|
1939
|
-
}
|
|
1940
|
-
res += "".concat(calc);
|
|
1941
|
-
}
|
|
1942
|
-
return res;
|
|
1943
|
-
}
|
|
1944
|
-
}, {
|
|
1945
|
-
key: "toJSON",
|
|
1946
|
-
value:
|
|
1947
|
-
/**
|
|
1948
|
-
* Convert `this` to a JSON object
|
|
1949
|
-
* @returns a JSON object
|
|
1950
|
-
*/
|
|
1951
|
-
function toJSON() {
|
|
1952
|
-
return "PN" + this.toString();
|
|
1953
|
-
}
|
|
1954
|
-
}, {
|
|
1955
|
-
key: "arr01",
|
|
1956
|
-
get:
|
|
1957
|
-
/**
|
|
1958
|
-
* A property array value for version 0.1.x PowiainaNum.
|
|
1959
|
-
*/
|
|
1960
|
-
function get() {
|
|
1961
|
-
var res = [0];
|
|
1962
|
-
for (var i = 0; i < this.array.length; i++) {
|
|
1963
|
-
if (i == 0) res[0] = this.array[i].repeat;else {
|
|
1964
|
-
// @ts-ignore
|
|
1965
|
-
res[i] = [0, 0, 0, 0];
|
|
1966
|
-
// @ts-ignore
|
|
1967
|
-
res[i][0] = this.array[i].arrow == Infinity ? "x" : this.array[i].arrow;
|
|
1968
|
-
// @ts-ignore
|
|
1969
|
-
res[i][1] = this.array[i].repeat;
|
|
1970
|
-
// @ts-ignore
|
|
1971
|
-
res[i][2] = this.array[i].expans == Infinity ? "x" : this.array[i].expans;
|
|
1972
|
-
// @ts-ignore
|
|
1973
|
-
res[i][3] = this.array[i].megota;
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
return res;
|
|
1977
|
-
}
|
|
1978
2114
|
}], [{
|
|
1979
2115
|
key: "add",
|
|
1980
2116
|
value: function add(t, other) {
|
|
1981
2117
|
return new PowiainaNum(t).add(other);
|
|
1982
2118
|
}
|
|
2119
|
+
}, {
|
|
2120
|
+
key: "plus",
|
|
2121
|
+
value: function plus(t, other) {
|
|
2122
|
+
return new PowiainaNum(t).add(other);
|
|
2123
|
+
}
|
|
1983
2124
|
}, {
|
|
1984
2125
|
key: "sub",
|
|
1985
2126
|
value: function sub(t, other) {
|
|
1986
2127
|
return new PowiainaNum(t).sub(other);
|
|
1987
2128
|
}
|
|
2129
|
+
}, {
|
|
2130
|
+
key: "minus",
|
|
2131
|
+
value: function minus(t, other) {
|
|
2132
|
+
return new PowiainaNum(t).sub(other);
|
|
2133
|
+
}
|
|
1988
2134
|
}, {
|
|
1989
2135
|
key: "mul",
|
|
1990
2136
|
value: function mul(t, other) {
|
|
1991
2137
|
return new PowiainaNum(t).mul(other);
|
|
1992
2138
|
}
|
|
2139
|
+
}, {
|
|
2140
|
+
key: "times",
|
|
2141
|
+
value: function times(t, other) {
|
|
2142
|
+
return new PowiainaNum(t).mul(other);
|
|
2143
|
+
}
|
|
1993
2144
|
}, {
|
|
1994
2145
|
key: "div",
|
|
1995
2146
|
value: function div(t, other) {
|
|
1996
2147
|
return new PowiainaNum(t).div(other);
|
|
1997
2148
|
}
|
|
2149
|
+
}, {
|
|
2150
|
+
key: "divide",
|
|
2151
|
+
value: function divide(t, other) {
|
|
2152
|
+
return new PowiainaNum(t).div(other);
|
|
2153
|
+
}
|
|
2154
|
+
}, {
|
|
2155
|
+
key: "mod",
|
|
2156
|
+
value: function mod(x, y) {
|
|
2157
|
+
return new PowiainaNum(x).mod(y);
|
|
2158
|
+
}
|
|
2159
|
+
}, {
|
|
2160
|
+
key: "modulus",
|
|
2161
|
+
value: function modulus(x, y) {
|
|
2162
|
+
return new PowiainaNum(x).mod(y);
|
|
2163
|
+
}
|
|
1998
2164
|
}, {
|
|
1999
2165
|
key: "pow",
|
|
2000
2166
|
value: function pow(t, other) {
|
|
@@ -2026,6 +2192,17 @@
|
|
|
2026
2192
|
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Math.E;
|
|
2027
2193
|
return new PowiainaNum(t).log(base);
|
|
2028
2194
|
}
|
|
2195
|
+
}, {
|
|
2196
|
+
key: "log2",
|
|
2197
|
+
value: function log2(t) {
|
|
2198
|
+
return new PowiainaNum(t).log2();
|
|
2199
|
+
}
|
|
2200
|
+
}, {
|
|
2201
|
+
key: "logBase",
|
|
2202
|
+
value: function logBase(t) {
|
|
2203
|
+
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Math.E;
|
|
2204
|
+
return new PowiainaNum(t).log(base);
|
|
2205
|
+
}
|
|
2029
2206
|
}, {
|
|
2030
2207
|
key: "pLog10",
|
|
2031
2208
|
value: function pLog10(t) {
|
|
@@ -2177,6 +2354,27 @@
|
|
|
2177
2354
|
};
|
|
2178
2355
|
}
|
|
2179
2356
|
}
|
|
2357
|
+
}, {
|
|
2358
|
+
key: "pentate",
|
|
2359
|
+
value: function pentate(x, other, payload) {
|
|
2360
|
+
return new PowiainaNum(x).arrow(3)(other, payload);
|
|
2361
|
+
}
|
|
2362
|
+
}, {
|
|
2363
|
+
key: "hexate",
|
|
2364
|
+
value: function hexate(x, other, payload) {
|
|
2365
|
+
return new PowiainaNum(x).arrow(4)(other, payload);
|
|
2366
|
+
}
|
|
2367
|
+
}, {
|
|
2368
|
+
key: "pent",
|
|
2369
|
+
value: function pent(x, other, payload) {
|
|
2370
|
+
return new PowiainaNum(x).arrow(3)(other, payload);
|
|
2371
|
+
}
|
|
2372
|
+
}, {
|
|
2373
|
+
key: "penta_log",
|
|
2374
|
+
value: function penta_log(x) {
|
|
2375
|
+
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
|
|
2376
|
+
return new PowiainaNum(x).anyarrow_log(3)(base);
|
|
2377
|
+
}
|
|
2180
2378
|
}, {
|
|
2181
2379
|
key: "expansion",
|
|
2182
2380
|
value: function expansion(t, other) {
|
|
@@ -2428,6 +2626,84 @@
|
|
|
2428
2626
|
value: function clampMax() {
|
|
2429
2627
|
return PowiainaNum.min.apply(PowiainaNum, arguments);
|
|
2430
2628
|
}
|
|
2629
|
+
}, {
|
|
2630
|
+
key: "eq",
|
|
2631
|
+
value: function eq(a, o) {
|
|
2632
|
+
return new PowiainaNum(a).eq(o);
|
|
2633
|
+
}
|
|
2634
|
+
}, {
|
|
2635
|
+
key: "equals",
|
|
2636
|
+
value: function equals(a, o) {
|
|
2637
|
+
return new PowiainaNum(a).eq(o);
|
|
2638
|
+
}
|
|
2639
|
+
}, {
|
|
2640
|
+
key: "neq",
|
|
2641
|
+
value: function neq(a, o) {
|
|
2642
|
+
return new PowiainaNum(a).neq(o);
|
|
2643
|
+
}
|
|
2644
|
+
}, {
|
|
2645
|
+
key: "notEquals",
|
|
2646
|
+
value: function notEquals(a, o) {
|
|
2647
|
+
return new PowiainaNum(a).notEquals(o);
|
|
2648
|
+
}
|
|
2649
|
+
}, {
|
|
2650
|
+
key: "lt",
|
|
2651
|
+
value: function lt(a, o) {
|
|
2652
|
+
return new PowiainaNum(a).lt(o);
|
|
2653
|
+
}
|
|
2654
|
+
}, {
|
|
2655
|
+
key: "gt",
|
|
2656
|
+
value: function gt(a, o) {
|
|
2657
|
+
return new PowiainaNum(a).gt(o);
|
|
2658
|
+
}
|
|
2659
|
+
}, {
|
|
2660
|
+
key: "lte",
|
|
2661
|
+
value: function lte(a, o) {
|
|
2662
|
+
return new PowiainaNum(a).lte(o);
|
|
2663
|
+
}
|
|
2664
|
+
}, {
|
|
2665
|
+
key: "gte",
|
|
2666
|
+
value: function gte(a, o) {
|
|
2667
|
+
return new PowiainaNum(a).gte(o);
|
|
2668
|
+
}
|
|
2669
|
+
}, {
|
|
2670
|
+
key: "rec",
|
|
2671
|
+
value: function rec(t) {
|
|
2672
|
+
return new PowiainaNum(t).rec();
|
|
2673
|
+
}
|
|
2674
|
+
}, {
|
|
2675
|
+
key: "recip",
|
|
2676
|
+
value: function recip(t) {
|
|
2677
|
+
return new PowiainaNum(t).rec();
|
|
2678
|
+
}
|
|
2679
|
+
}, {
|
|
2680
|
+
key: "reciprocate",
|
|
2681
|
+
value: function reciprocate(t) {
|
|
2682
|
+
return new PowiainaNum(t).rec();
|
|
2683
|
+
}
|
|
2684
|
+
}, {
|
|
2685
|
+
key: "floor",
|
|
2686
|
+
value: function floor(x) {
|
|
2687
|
+
return new PowiainaNum(x).floor();
|
|
2688
|
+
}
|
|
2689
|
+
}, {
|
|
2690
|
+
key: "ceil",
|
|
2691
|
+
value: function ceil(x) {
|
|
2692
|
+
return new PowiainaNum(x).ceil();
|
|
2693
|
+
}
|
|
2694
|
+
}, {
|
|
2695
|
+
key: "round",
|
|
2696
|
+
value: function round(x) {
|
|
2697
|
+
return new PowiainaNum(x).round();
|
|
2698
|
+
}
|
|
2699
|
+
}, {
|
|
2700
|
+
key: "trunc",
|
|
2701
|
+
value: function trunc(x) {
|
|
2702
|
+
return new PowiainaNum(x).trunc();
|
|
2703
|
+
}
|
|
2704
|
+
/**
|
|
2705
|
+
* @returns if this<other, return -1, if this=other, return 0, if this>other, return 1, if this!<=>, return 2
|
|
2706
|
+
*/
|
|
2431
2707
|
}, {
|
|
2432
2708
|
key: "sign",
|
|
2433
2709
|
value: function sign(a) {
|
|
@@ -2442,6 +2718,17 @@
|
|
|
2442
2718
|
key: "fromNumber",
|
|
2443
2719
|
value: function fromNumber(x) {
|
|
2444
2720
|
var obj = new PowiainaNum(); // NaN
|
|
2721
|
+
obj.resetFromObject({
|
|
2722
|
+
array: [{
|
|
2723
|
+
arrow: 0,
|
|
2724
|
+
expans: 1,
|
|
2725
|
+
megota: 1,
|
|
2726
|
+
repeat: NaN
|
|
2727
|
+
}],
|
|
2728
|
+
small: false,
|
|
2729
|
+
layer: 0,
|
|
2730
|
+
sign: 0
|
|
2731
|
+
});
|
|
2445
2732
|
if (x < 0) obj.sign = -1; // negative
|
|
2446
2733
|
else if (x == 0) {
|
|
2447
2734
|
obj.sign = 0;
|
|
@@ -2469,10 +2756,26 @@
|
|
|
2469
2756
|
}, {
|
|
2470
2757
|
key: "fromString",
|
|
2471
2758
|
value: function fromString(input) {
|
|
2759
|
+
if (PowiainaNum.usingBreakEternityLikeFromString && BE_REGEX.test(input)) {
|
|
2760
|
+
/*
|
|
2761
|
+
* 0i00000000a7 says that eee-3000 will wrongly parse to 1. So i added this
|
|
2762
|
+
*/
|
|
2763
|
+
var a = input.match(/(e+-)(\d+(.\d+)?)/);
|
|
2764
|
+
if (a) {
|
|
2765
|
+
var e_s = a[1].length;
|
|
2766
|
+
input = "e-" + "e".repeat(e_s - 1) + a[2];
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
return this.fromString_core(input);
|
|
2770
|
+
}
|
|
2771
|
+
}, {
|
|
2772
|
+
key: "fromString_core",
|
|
2773
|
+
value: function fromString_core(input) {
|
|
2472
2774
|
var _b, _c, _d, _e, _f, _g;
|
|
2473
|
-
var x = new PowiainaNum();
|
|
2775
|
+
var x = new PowiainaNum(NaN);
|
|
2474
2776
|
// Judge the string was a number
|
|
2475
2777
|
if (input.startsWith("PN")) input = input.substring(2);
|
|
2778
|
+
if (input == "NaN") return PowiainaNum.NaN.clone();
|
|
2476
2779
|
input = input.replace(/J\^(\d+)/g, "(10{!})^$1");
|
|
2477
2780
|
input = input.replace(/J/g, "10{!}");
|
|
2478
2781
|
input = input.replace(/K\^(\d+)/g, "(10{1,2})^$1");
|
|
@@ -2483,17 +2786,20 @@
|
|
|
2483
2786
|
input = input.replace(/M/g, "10{!,2}");
|
|
2484
2787
|
input = input.replace(/N\^(\d+)/g, "(10{1,!})^$1");
|
|
2485
2788
|
input = input.replace(/N/g, "10{1,!}");
|
|
2789
|
+
if (/^.*e-.*(e|\^).*/.test(input)) {
|
|
2790
|
+
input = "/10^" + input.substring(input.indexOf("e-"));
|
|
2791
|
+
}
|
|
2486
2792
|
if (!isNaN(Number(input))) {
|
|
2487
2793
|
var res = Number(input);
|
|
2488
|
-
var
|
|
2794
|
+
var a = false;
|
|
2489
2795
|
if (res == 0) {
|
|
2490
2796
|
if (/^((0)|(0*\.0+e\d+)|(0*\.0*))$/.test(input)) {
|
|
2491
|
-
|
|
2797
|
+
a = true;
|
|
2492
2798
|
}
|
|
2493
2799
|
} else {
|
|
2494
|
-
|
|
2800
|
+
a = true;
|
|
2495
2801
|
}
|
|
2496
|
-
if (!
|
|
2802
|
+
if (!a) {
|
|
2497
2803
|
var m = input.search(/e/);
|
|
2498
2804
|
var exponent = input.substring((m == -1 ? input.length : m) + 1);
|
|
2499
2805
|
var mantissa = input.substring(0, m == -1 ? undefined : m);
|
|
@@ -2503,11 +2809,11 @@
|
|
|
2503
2809
|
// Is regular number gte 1:
|
|
2504
2810
|
if (Number(mantissa) >= 1) {
|
|
2505
2811
|
// check The mantissa is very long?
|
|
2506
|
-
var log10mant = mantissa.length >= LONG_STRING_MIN_LENGTH ? log10LongString(mantissa) : Math.log10(Number(mantissa));
|
|
2507
|
-
var log10int = Math.floor(log10mant);
|
|
2508
|
-
var log10float = log10mant - log10int;
|
|
2812
|
+
var log10mant = mantissa.length >= LONG_STRING_MIN_LENGTH ? log10LongString(mantissa) : Math.log10(Number(mantissa)); // sample 10
|
|
2813
|
+
var log10int = Math.floor(log10mant); // sample 1
|
|
2814
|
+
var log10float = log10mant - log10int; // sample 0;
|
|
2509
2815
|
mantissaME[0] = Math.pow(10, log10float);
|
|
2510
|
-
mantissaME[1] +=
|
|
2816
|
+
mantissaME[1] += log10int;
|
|
2511
2817
|
} else {
|
|
2512
2818
|
// If not , count how many zeros until reached non-zero numbers
|
|
2513
2819
|
var zeros = countLeadingZerosAfterDecimal(mantissa);
|
|
@@ -2522,7 +2828,7 @@
|
|
|
2522
2828
|
// /((a*10^b)^-1) = /(a^-1*10^-b) = /(a^-1 * 10 * 10^(-b-1))
|
|
2523
2829
|
return PowiainaNum.pow(10, -mantissaME[1] - 1).mul(Math.pow(mantissaME[0], -1) * 10).rec();
|
|
2524
2830
|
}
|
|
2525
|
-
if (isFinite(res) &&
|
|
2831
|
+
if (isFinite(res) && a) {
|
|
2526
2832
|
x = PowiainaNum.fromNumber(Number(input));
|
|
2527
2833
|
return x;
|
|
2528
2834
|
}
|
|
@@ -2539,6 +2845,7 @@
|
|
|
2539
2845
|
return x;
|
|
2540
2846
|
}
|
|
2541
2847
|
input = replaceETo10(input);
|
|
2848
|
+
input = removeCommasOutsideBraces(input);
|
|
2542
2849
|
if (!isPowiainaNum.test(input)) {
|
|
2543
2850
|
throw powiainaNumError + "malformed input: " + input;
|
|
2544
2851
|
}
|
|
@@ -2551,28 +2858,31 @@
|
|
|
2551
2858
|
input = input.substring(numSigns);
|
|
2552
2859
|
}
|
|
2553
2860
|
if (input[0] == "/") {
|
|
2554
|
-
var
|
|
2555
|
-
var
|
|
2556
|
-
recipIt = ((_e = (_d =
|
|
2557
|
-
input = input.substring(
|
|
2861
|
+
var _numSigns = input.search(/[^\/]/);
|
|
2862
|
+
var _signs = input.substring(0, _numSigns);
|
|
2863
|
+
recipIt = ((_e = (_d = _signs.match(/\//g)) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0) % 2 == 1;
|
|
2864
|
+
input = input.substring(_numSigns);
|
|
2558
2865
|
}
|
|
2559
2866
|
if (input == "NaN") x.array = [newOperator(NaN)];else if (input == "Infinity") x.array = [newOperator(Infinity)];else {
|
|
2560
2867
|
x.sign = 1;
|
|
2561
2868
|
x.array = [newOperator(0)];
|
|
2562
|
-
var
|
|
2869
|
+
var _a3, b, c, d;
|
|
2563
2870
|
if (input[0] == "P") {
|
|
2564
2871
|
if (input[1] == "^") {
|
|
2565
|
-
|
|
2566
|
-
x.layer = Number(input.substring(2,
|
|
2567
|
-
input = input.substring(
|
|
2872
|
+
_a3 = input.substring(2).search(/[^0-9]/) + 2;
|
|
2873
|
+
x.layer = Number(input.substring(2, _a3));
|
|
2874
|
+
input = input.substring(_a3 + 1);
|
|
2568
2875
|
} else {
|
|
2569
|
-
|
|
2570
|
-
x.layer =
|
|
2571
|
-
input = input.substring(
|
|
2876
|
+
_a3 = input.search(/[^P]/);
|
|
2877
|
+
x.layer = _a3;
|
|
2878
|
+
input = input.substring(_a3);
|
|
2572
2879
|
}
|
|
2573
2880
|
}
|
|
2574
2881
|
while (input) {
|
|
2575
2882
|
if (/^(\(?10[\^\{])/.test(input)) {
|
|
2883
|
+
var arrows = void 0,
|
|
2884
|
+
expans = void 0,
|
|
2885
|
+
megota = void 0;
|
|
2576
2886
|
/*
|
|
2577
2887
|
10^ - 匹配
|
|
2578
2888
|
10{ - 匹配
|
|
@@ -2583,30 +2893,29 @@
|
|
|
2583
2893
|
*/
|
|
2584
2894
|
if (input[0] == "(") input = input.substring(1);
|
|
2585
2895
|
//cutted, 10^.... or 10{....
|
|
2586
|
-
var arrows, expans, megota;
|
|
2587
2896
|
if (input[2] == "^") {
|
|
2588
|
-
|
|
2897
|
+
_a3 = input.substring(2).search(/[^\^]/);
|
|
2589
2898
|
//cut input to ^^...^^, and search how numbers
|
|
2590
|
-
arrows =
|
|
2899
|
+
arrows = _a3;
|
|
2591
2900
|
// 10^^^
|
|
2592
|
-
b =
|
|
2901
|
+
b = _a3 + 2; // b points to after ^'s.
|
|
2593
2902
|
} else {
|
|
2594
2903
|
// 10{...}
|
|
2595
|
-
|
|
2904
|
+
_a3 = input.indexOf("}");
|
|
2596
2905
|
// select contents between {...}
|
|
2597
|
-
var tmp = input.substring(3,
|
|
2906
|
+
var tmp = input.substring(3, _a3).split(",");
|
|
2598
2907
|
arrows = Number(tmp[0] == "!" ? Infinity : tmp[0]);
|
|
2599
2908
|
expans = Number((_f = tmp[1] == "!" ? Infinity : tmp[1]) !== null && _f !== void 0 ? _f : 1);
|
|
2600
2909
|
megota = Number((_g = tmp[2]) !== null && _g !== void 0 ? _g : 1);
|
|
2601
|
-
b =
|
|
2910
|
+
b = _a3 + 1;
|
|
2602
2911
|
// b points to after }.
|
|
2603
2912
|
}
|
|
2604
2913
|
input = input.substring(b);
|
|
2605
2914
|
if (input[0] == ")") {
|
|
2606
2915
|
// )^....<Space>
|
|
2607
|
-
|
|
2608
|
-
c = Number(input.substring(2,
|
|
2609
|
-
input = input.substring(
|
|
2916
|
+
_a3 = input.indexOf(" ");
|
|
2917
|
+
c = Number(input.substring(2, _a3)); // Select contents between )^....<Space>
|
|
2918
|
+
input = input.substring(_a3 + 1); // c points to after <Space>
|
|
2610
2919
|
} else {
|
|
2611
2920
|
c = 1; // There is only spaces, count as <ONE>
|
|
2612
2921
|
}
|
|
@@ -2617,21 +2926,21 @@
|
|
|
2617
2926
|
x.array.splice(1, 0, newOperator(c, 1, expans, megota));
|
|
2618
2927
|
}
|
|
2619
2928
|
} else if (arrows == 2 && expans == 1 && megota == 1) {
|
|
2620
|
-
|
|
2929
|
+
_a3 = x.array.length >= 2 && x.array[1].arrow == 1 ? x.array[1].repeat : 0;
|
|
2621
2930
|
b = x.array[0].repeat;
|
|
2622
|
-
if (b >= 1e10) ++
|
|
2623
|
-
if (b >= 10) ++
|
|
2624
|
-
x.array[0].repeat =
|
|
2931
|
+
if (b >= 1e10) ++_a3;
|
|
2932
|
+
if (b >= 10) ++_a3;
|
|
2933
|
+
x.array[0].repeat = _a3;
|
|
2625
2934
|
if (x.array.length >= 2 && x.array[1].arrow == 1) x.array.splice(1, 1);
|
|
2626
2935
|
d = x.getOperatorIndex(2);
|
|
2627
2936
|
if (Number.isInteger(d)) x.array[d].repeat += c;else x.array.splice(Math.ceil(d), 0, newOperator(c, 2, expans, megota));
|
|
2628
2937
|
} else if (isFinite(arrows)) {
|
|
2629
|
-
|
|
2938
|
+
_a3 = x.getOperator(arrows - 1);
|
|
2630
2939
|
b = x.getOperator(arrows - 2);
|
|
2631
|
-
if (b >= 10) ++
|
|
2940
|
+
if (b >= 10) ++_a3;
|
|
2632
2941
|
d = x.getOperatorIndex(arrows);
|
|
2633
2942
|
x.array.splice(1, Math.ceil(d) - 1);
|
|
2634
|
-
x.array[0].repeat =
|
|
2943
|
+
x.array[0].repeat = _a3;
|
|
2635
2944
|
if (Number.isInteger(d)) x.array[1].repeat += c;else x.array.splice(1, 0, newOperator(c, arrows, expans, megota));
|
|
2636
2945
|
} else {
|
|
2637
2946
|
x.array.splice(1, 0, newOperator(c, arrows, expans, megota));
|
|
@@ -2640,10 +2949,10 @@
|
|
|
2640
2949
|
break;
|
|
2641
2950
|
}
|
|
2642
2951
|
}
|
|
2643
|
-
|
|
2952
|
+
_a3 = input.split(/[Ee]/);
|
|
2644
2953
|
b = [x.array[0].repeat, 0];
|
|
2645
2954
|
c = 1;
|
|
2646
|
-
for (var
|
|
2955
|
+
for (var i = _a3.length - 1; i >= 0; --i) {
|
|
2647
2956
|
//The things that are already there
|
|
2648
2957
|
if (b[0] < MSI_LOG10 && b[1] === 0) {
|
|
2649
2958
|
b[0] = Math.pow(10, c * b[0]);
|
|
@@ -2660,12 +2969,12 @@
|
|
|
2660
2969
|
b[1]++;
|
|
2661
2970
|
}
|
|
2662
2971
|
//Multiplying coefficient
|
|
2663
|
-
var decimalPointPos =
|
|
2664
|
-
var intPartLen = decimalPointPos == -1 ?
|
|
2972
|
+
var decimalPointPos = _a3[i].indexOf(".");
|
|
2973
|
+
var intPartLen = decimalPointPos == -1 ? _a3[i].length : decimalPointPos;
|
|
2665
2974
|
if (b[1] === 0) {
|
|
2666
|
-
if (intPartLen >= LONG_STRING_MIN_LENGTH) b[0] = Math.log10(b[0]) + log10LongString(
|
|
2975
|
+
if (intPartLen >= LONG_STRING_MIN_LENGTH) b[0] = Math.log10(b[0]) + log10LongString(_a3[i].substring(0, intPartLen)), b[1] = 1;else if (_a3[i]) b[0] *= Number(_a3[i]);
|
|
2667
2976
|
} else {
|
|
2668
|
-
d = intPartLen >= LONG_STRING_MIN_LENGTH ? log10LongString(
|
|
2977
|
+
d = intPartLen >= LONG_STRING_MIN_LENGTH ? log10LongString(_a3[i].substring(0, intPartLen)) : _a3[i] ? Math.log10(Number(_a3[i])) : 0;
|
|
2669
2978
|
if (b[1] == 1) {
|
|
2670
2979
|
b[0] += d;
|
|
2671
2980
|
} else if (b[1] == 2 && b[0] < MSI_LOG10 + Math.log10(d)) {
|
|
@@ -2696,6 +3005,17 @@
|
|
|
2696
3005
|
key: "fromObject",
|
|
2697
3006
|
value: function fromObject(powlikeObject) {
|
|
2698
3007
|
var obj = new PowiainaNum();
|
|
3008
|
+
obj.resetFromObject({
|
|
3009
|
+
array: [{
|
|
3010
|
+
arrow: 0,
|
|
3011
|
+
expans: 1,
|
|
3012
|
+
megota: 1,
|
|
3013
|
+
repeat: NaN
|
|
3014
|
+
}],
|
|
3015
|
+
small: false,
|
|
3016
|
+
layer: 0,
|
|
3017
|
+
sign: 0
|
|
3018
|
+
});
|
|
2699
3019
|
obj.array = [];
|
|
2700
3020
|
if (isExpantaNumArray(powlikeObject)) {
|
|
2701
3021
|
for (var i = 0; i < powlikeObject.length; i++) {
|
|
@@ -2713,8 +3033,8 @@
|
|
|
2713
3033
|
} else if (isPowiainaNum01XArray(powlikeObject)) {
|
|
2714
3034
|
var arrayobj = powlikeObject;
|
|
2715
3035
|
obj.array[0] = newOperator(arrayobj[0]);
|
|
2716
|
-
for (var
|
|
2717
|
-
var b = arrayobj[
|
|
3036
|
+
for (var _i4 = 1; _i4 < arrayobj.length; _i4++) {
|
|
3037
|
+
var b = arrayobj[_i4];
|
|
2718
3038
|
obj.array[1] = newOperator(b[1], replaceXToInfinity(b[0]), replaceXToInfinity(b[2]), b[3]);
|
|
2719
3039
|
}
|
|
2720
3040
|
obj.small = false;
|
|
@@ -2722,21 +3042,21 @@
|
|
|
2722
3042
|
obj.layer = 0;
|
|
2723
3043
|
return obj;
|
|
2724
3044
|
} else {
|
|
2725
|
-
|
|
2726
|
-
obj.array[_i4] = {
|
|
2727
|
-
arrow: powlikeObject.array[_i4].arrow,
|
|
2728
|
-
expans: powlikeObject.array[_i4].expans,
|
|
2729
|
-
megota: powlikeObject.array[_i4].megota,
|
|
2730
|
-
repeat: powlikeObject.array[_i4].repeat,
|
|
2731
|
-
valuereplaced: powlikeObject.array[_i4].valuereplaced
|
|
2732
|
-
};
|
|
2733
|
-
}
|
|
2734
|
-
obj.small = powlikeObject.small;
|
|
2735
|
-
obj.sign = powlikeObject.sign;
|
|
2736
|
-
obj.layer = powlikeObject.layer;
|
|
3045
|
+
obj.resetFromObject(powlikeObject);
|
|
2737
3046
|
return obj;
|
|
2738
3047
|
}
|
|
2739
3048
|
}
|
|
3049
|
+
}, {
|
|
3050
|
+
key: "grahalFunction",
|
|
3051
|
+
value: function grahalFunction(layers2) {
|
|
3052
|
+
var layers = new PowiainaNum(layers2);
|
|
3053
|
+
if (!layers.isInt() || layers.lt(0) || layers.isNaN()) return PowiainaNum.NaN.clone();
|
|
3054
|
+
if (layers.eq(1)) return new PowiainaNum("10^^^(10^)^7625597484984 3638334640023.7783");else if (layers.lte(MSI)) {
|
|
3055
|
+
return new PowiainaNum("(10{!})^".concat(layers.toNumber(), " 10^^^(10^)^7625597484984 3638334640023.7783"));
|
|
3056
|
+
} else {
|
|
3057
|
+
return PowiainaNum.BEAF(3, layers, 1, 2);
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
2740
3060
|
}]);
|
|
2741
3061
|
}();
|
|
2742
3062
|
_a = Symbol.toStringTag;
|
|
@@ -2953,6 +3273,15 @@
|
|
|
2953
3273
|
PowiainaNum.POW_2_44_MOD_PI = 1.701173079953;
|
|
2954
3274
|
//#endregion
|
|
2955
3275
|
PowiainaNum.arrowFuncMap = new Map();
|
|
3276
|
+
//#region configurations
|
|
3277
|
+
/**
|
|
3278
|
+
* If you set this config to true, the `fromString` method will try to parse the string to `PowiainaNum` class with `break_eternity.js` similar `fromString` method, if cannot parse correctly, the program will use `PowiainaNum.js` `fromString` method.
|
|
3279
|
+
*/
|
|
3280
|
+
PowiainaNum.usingBreakEternityLikeFromString = false;
|
|
3281
|
+
/**
|
|
3282
|
+
* If you set this config to true, the `constructor` method will return Zero instead of NaN when call new PowiainaNum() with no arguments.
|
|
3283
|
+
*/
|
|
3284
|
+
PowiainaNum.blankArgumentConstructorReturnZero = false;
|
|
2956
3285
|
|
|
2957
3286
|
exports.arraySortFunction = arraySortFunction;
|
|
2958
3287
|
exports["default"] = PowiainaNum;
|