powiaina_num.js 0.1.12 → 0.2.0-alpha.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 +62 -5
- package/dist/PowiainaNum.cjs.js +994 -0
- package/dist/PowiainaNum.esm.js +992 -0
- package/dist/PowiainaNum.js +1000 -0
- package/dist/PowiainaNum.min.js +1 -0
- package/dist/index.d.ts +105 -0
- package/package.json +21 -5
- package/.gitattributes +0 -1
- package/PowiainaNum.d.ts +0 -240
- package/PowiainaNum.esm.js +0 -2005
- package/PowiainaNum.js +0 -2041
package/README.md
CHANGED
|
@@ -4,11 +4,68 @@ A JavaScript library that handles arithmetic for numbers as large as {10,9e15,1,
|
|
|
4
4
|
|
|
5
5
|
This reaches level f<sub>ω<sup>3</sup>+1</sub>.
|
|
6
6
|
|
|
7
|
-
Internally, it is represented as an sign,layer and array. Sign is 1 or -1.
|
|
8
|
-
|
|
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
9
|
Some codes snippet from [ExpantaNum.js by Naruyoko](https://github.com/Naruyoko/ExpantaNum.js)
|
|
10
10
|
|
|
11
|
-
Functions are as follows `abs, neg, add, sub, mul, div, rec, pow,
|
|
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";
|
|
20
|
+
|
|
21
|
+
let a = new PowiainaNum(); // create PN.js number with NaN
|
|
22
|
+
let b = new PowiainaNum(3); // create PN.js number with number 3
|
|
23
|
+
let c = new PowiainaNum("1e114514"); // create PN.js number with number 10^114514
|
|
24
|
+
|
|
25
|
+
let d = new PowiainaNum(c); // create PN.js number from a PN.js number
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Javascript operators will not work such as `+`, `-`, etc.
|
|
29
|
+
You should call the equivalent functions instead.
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
let a = new PowiainaNum(114514);
|
|
33
|
+
let b = new PowiainaNum(1919810);
|
|
34
|
+
|
|
35
|
+
// Calculate a+b:
|
|
36
|
+
let c = a.add(b); // 1919810+114514
|
|
37
|
+
|
|
38
|
+
// Calculate a-b:
|
|
39
|
+
let c = a.sub(b);
|
|
40
|
+
|
|
41
|
+
a.mul(b); // a*b
|
|
42
|
+
a.div(b); // a/b
|
|
43
|
+
a.pow(b); // a^b
|
|
44
|
+
|
|
45
|
+
a.log10(); // log10(a)
|
|
46
|
+
|
|
47
|
+
// comparing PN.js numbers
|
|
48
|
+
|
|
49
|
+
a.lt(b); // a is less than b
|
|
50
|
+
a.gt(b); // a is greater than b
|
|
51
|
+
a.eq(b); // a is equals to b
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Future ideas
|
|
55
|
+
|
|
56
|
+
Extend `Operator` to nearly infinite keys to reach level f<sub>ω<sup>ω</sup></sub>
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
interface Operator {
|
|
60
|
+
/*P3*/ arrow: number;
|
|
61
|
+
/*P4*/ expans: number;
|
|
62
|
+
/*P5*/ megota: number;
|
|
63
|
+
/*P6*/ powiaina: number;
|
|
64
|
+
P7: number;
|
|
65
|
+
.....
|
|
66
|
+
|
|
67
|
+
repeat: number;
|
|
12
68
|
|
|
13
|
-
|
|
14
|
-
|
|
69
|
+
valuereplaced?: -1 | 0 | 1 | 2 | ...
|
|
70
|
+
}
|
|
71
|
+
```
|