powiaina_num.js 0.2.0-alpha.2.9 → 0.2.0-alpha.3.1

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 CHANGED
@@ -1,72 +1,98 @@
1
- # PowiainaNum.js
2
-
3
- A JavaScript library that handles arithmetic for numbers as large as {10,9e15,1,1,1,2}.
4
-
5
- This reaches level f<sub>ω<sup>3</sup>+1</sub>.
6
-
7
- Internally, it is represented as an sign,layer, small and array. Sign is 1 or -1. It's 10{oper.arrow, oper.expans, oper.megota}, If arrow count or expans count is Infinite, the count replaces from the next operators.
8
-
9
- Some codes snippet from [ExpantaNum.js by Naruyoko](https://github.com/Naruyoko/ExpantaNum.js)
10
-
11
- Functions are as follows `abs, neg, add, sub, mul, div, rec, pow, sqrt, cbrt, root, log10, log, cmp, isFinite, isInfinite, isNaN`(some missing items that have not been fully developed)
12
-
13
- ## Using
14
-
15
- The library exports a class,
16
- Create a PowiainaNum.js object like this:
17
-
18
- ```javascript
19
- import PowiainaNum from "powiaina_num.js"; // static import
20
- const { default: PowiainaNum } = await import("powiaina_num.js") // dynamic import
21
-
22
- let a = new PowiainaNum(); // create PN.js number with NaN
23
- let b = new PowiainaNum(3); // create PN.js number with number 3
24
- let c = new PowiainaNum("1e114514"); // create PN.js number with number 10^114514
25
-
26
- let d = new PowiainaNum(c); // create PN.js number from a PN.js number
27
- ```
28
-
29
- Javascript operators will not work such as `+`, `-`, etc.
30
- You should call the equivalent functions instead.
31
-
32
- ```javascript
33
- let a = new PowiainaNum(114514);
34
- let b = new PowiainaNum(1919810);
35
-
36
- // Calculate a+b:
37
- let c = a.add(b); // 1919810+114514
38
-
39
- // Calculate a-b:
40
- let c = a.sub(b);
41
-
42
- a.mul(b); // a*b
43
- a.div(b); // a/b
44
- a.pow(b); // a^b
45
-
46
- a.log10(); // log10(a)
47
-
48
- // comparing PN.js numbers
49
-
50
- a.lt(b); // a is less than b
51
- a.gt(b); // a is greater than b
52
- a.eq(b); // a is equals to b
53
- ```
54
-
55
- ## Future ideas
56
-
57
- Extend `Operator` to nearly infinite keys to reach level f<sub>ω<sup>ω</sup></sub>
58
-
59
- ```typescript
60
- interface Operator {
61
- /*P3*/ arrow: number;
62
- /*P4*/ expans: number;
63
- /*P5*/ megota: number;
64
- /*P6*/ powiaina: number;
65
- P7: number;
66
- .....
67
-
68
- repeat: number;
69
-
70
- valuereplaced?: -1 | 0 | 1 | 2 | ...
71
- }
72
- ```
1
+ # PowiainaNum.js
2
+
3
+ A JavaScript library that handles arithmetic for numbers as large as {10,9e15,1,1,1,2}.
4
+
5
+ This reaches level f<sub>ω<sup>3</sup>+1</sub>.
6
+
7
+ Internally, it is represented as an sign, array, small, and layer. Sign is 1 or -1. . Layer is a non-negative integer.
8
+
9
+ The operator interface is `interface {arrow: number; expans: number; megota: number; repeat: number;}`, which respents {10, {10, ...{10, X, arrow, expans, megota}..., arrow, expans, megota}, arrow, expans, megota} (repeat means counts of 10's);
10
+
11
+ The array is `Operator[]`
12
+
13
+ when $$f(x) = \{10, 10, 10, 10, 10, x\}$$
14
+ $$g_{a,b,c}(x) = \{10,x,a,b,c\}$$
15
+ $$o_x = \text{last }x\text{th operator of array} $$
16
+ They together respents $s_{ign}\times f^{l_{ayer}} g_{o_1.arrow, o_1.expans, o_1.megota} g_{o_2.arrow, o_2.expans, o_2.megota} ...$
17
+
18
+ If arrow count or expans count is Infinite, the count replaces to the next operators.
19
+
20
+ Some codes snippet from [ExpantaNum.js by Naruyoko](https://github.com/Naruyoko/ExpantaNum.js)
21
+
22
+ Functions are as follows `abs, neg, add, sub, mul, div, rec, pow, pow10, pow_base, sqrt, cbrt, root, log10, log, cmp, rec, gamma, mod, exp, ln, slog, factorial, tetrate_10, isFinite, isInfinite, isNaN, tetrate, lambertw, toString, toJSON, floor, ceil, round, trunc, clampMax, clampMin`(some missing items that have not been fully developed)
23
+
24
+ ## Using
25
+
26
+ The library exports a class,
27
+ Create a PowiainaNum.js object like this:
28
+
29
+ ```javascript
30
+ import PowiainaNum from "powiaina_num.js"; // static import
31
+ const { default: PowiainaNum } = await import("powiaina_num.js") // dynamic import
32
+
33
+ let a = new PowiainaNum(); // create PN.js number with NaN
34
+ let b = new PowiainaNum(3); // create PN.js number with number 3
35
+ let c = new PowiainaNum("1e114514"); // create PN.js number with number 10^114514
36
+
37
+ let d = new PowiainaNum(c); // create PN.js number from a PN.js number
38
+
39
+ let e = new PowiainaNum([[0,23.2352],[1,2],[2,6],[3,0],[4,1],[5,4]]); // You can also use a pair number array which from ExpantaNum.js
40
+
41
+ let f = new PowiainaNum("(10^^^)^114514 e1919810") // ExpantaNum.js string form
42
+
43
+ let g = new PowiainaNum("10{!}e1919810") // 10{!} = 10{x}10, x points to e1919810, 10{!} = J in ExpantaNum.js
44
+ let h = new PowiainaNum("10{1,2}ee114514") // {10, ee114514, 1, 2}
45
+ let i = new PowiainaNum("10{1,514,114}ee114514") // {10, ee114514, 1, 514, 114}
46
+ let j = new PowiainaNum("/10{1,514,114}ee114514") // Very small numbers ({10, ee114514, 1, 514, 114})^-1
47
+ let k = new PowiainaNum("(e^114514)1919810") // break_eternity.js (e^x) form
48
+ ```
49
+
50
+ In browser, you can download `dist/PowiainaNum.min.js` or use
51
+ ```html
52
+ <script src="https://unpkg.com/powiaina_num.js@alpha"></script>
53
+ ```
54
+
55
+ Javascript operators will not work such as `+`, `-`, etc.
56
+ You should call the equivalent functions instead.
57
+
58
+ ```javascript
59
+ let a = new PowiainaNum(114514);
60
+ let b = new PowiainaNum(1919810);
61
+
62
+ // Calculate a+b:
63
+ let c = a.add(b); // 1919810+114514
64
+
65
+ // Calculate a-b:
66
+ let c = a.sub(b);
67
+
68
+ a.mul(b); // a*b
69
+ a.div(b); // a/b
70
+ a.pow(b); // a^b
71
+
72
+ a.log10(); // log10(a)
73
+
74
+ // comparing PN.js numbers
75
+
76
+ a.lt(b); // a is less than b
77
+ a.gt(b); // a is greater than b
78
+ a.eq(b); // a is equals to b
79
+ ```
80
+
81
+ ## Future ideas
82
+
83
+ Extend `Operator` to nearly infinite keys to reach level f<sub>ω<sup>ω</sup></sub>
84
+
85
+ ```typescript
86
+ interface Operator {
87
+ /*P3*/ arrow: number;
88
+ /*P4*/ expans: number;
89
+ /*P5*/ megota: number;
90
+ /*P6*/ powiaina: number;
91
+ P7: number;
92
+ .....
93
+
94
+ repeat: number;
95
+
96
+ valuereplaced?: -1 | 0 | 1 | 2 | ...
97
+ }
98
+ ```