powiaina_num.js 0.2.0-alpha.2.8 → 0.2.0-alpha.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.
@@ -0,0 +1,184 @@
1
+ interface Operator {
2
+ arrow: number;
3
+ expans: number;
4
+ megota: number;
5
+ repeat: number;
6
+ valuereplaced?: -1 | 0 | 1;
7
+ }
8
+ interface IPowiainaNum {
9
+ array: Operator[];
10
+ small: boolean;
11
+ sign: -1 | 0 | 1;
12
+ layer: number;
13
+ }
14
+ type ExpantaNumArray = [number, number][];
15
+ export type PowiainaNumSource = number | string | IPowiainaNum | PowiainaNum | ExpantaNumArray;
16
+ export default class PowiainaNum implements IPowiainaNum {
17
+ array: Operator[];
18
+ small: boolean;
19
+ sign: -1 | 0 | 1;
20
+ layer: number;
21
+ constructor(arg1?: PowiainaNumSource);
22
+ /**
23
+ * Addition
24
+ * @returns the sum of `this` and `other`
25
+ */
26
+ add(other: PowiainaNumSource): PowiainaNum;
27
+ static add(t: PowiainaNumSource, other: PowiainaNumSource): PowiainaNum;
28
+ sub(a: PowiainaNumSource): PowiainaNum;
29
+ static sub(t: PowiainaNumSource, other: PowiainaNumSource): PowiainaNum;
30
+ mul(other: PowiainaNumSource): PowiainaNum;
31
+ static mul(t: PowiainaNumSource, other: PowiainaNumSource): PowiainaNum;
32
+ div(other: PowiainaNumSource): PowiainaNum;
33
+ static div(t: PowiainaNumSource, other: PowiainaNumSource): PowiainaNum;
34
+ pow10(): PowiainaNum;
35
+ pow(x: PowiainaNumSource): PowiainaNum;
36
+ pow_base(x: PowiainaNumSource): PowiainaNum;
37
+ static pow(t: PowiainaNumSource, other: PowiainaNumSource): PowiainaNum;
38
+ root(x: PowiainaNumSource): PowiainaNum;
39
+ static root(t: PowiainaNumSource, other: PowiainaNumSource): PowiainaNum;
40
+ sqrt(): PowiainaNum;
41
+ static sqrt(t: PowiainaNumSource): PowiainaNum;
42
+ cbrt(): PowiainaNum;
43
+ static cbrt(t: PowiainaNumSource): PowiainaNum;
44
+ tetrate(other2: PowiainaNumSource, payload?: PowiainaNumSource): PowiainaNum;
45
+ slog(base?: PowiainaNumSource): PowiainaNum;
46
+ static tetrate(t: PowiainaNumSource, other2: PowiainaNumSource, payload?: PowiainaNumSource): PowiainaNum;
47
+ abs(): PowiainaNum;
48
+ log10(): PowiainaNum;
49
+ static log10(t: PowiainaNumSource): PowiainaNum;
50
+ log(base?: PowiainaNumSource): PowiainaNum;
51
+ static log(t: PowiainaNumSource, base?: PowiainaNumSource): PowiainaNum;
52
+ ln(): PowiainaNum;
53
+ static exp(x: PowiainaNumSource): PowiainaNum;
54
+ exp(): PowiainaNum;
55
+ mod(x: PowiainaNumSource): PowiainaNum;
56
+ /**
57
+ * For positive integers, X factorial (written as X!) equals X * (X - 1) * (X - 2) *... * 3 * 2 * 1. 0! equals 1.
58
+ * This can be extended to real numbers (except for negative integers) via the gamma function, which is what this function does.
59
+ */
60
+ factorial(): PowiainaNum;
61
+ static factorial(x: PowiainaNumSource): PowiainaNum;
62
+ /**
63
+ * The gamma function extends the idea of factorials to non-whole numbers using some calculus.
64
+ * Gamma(x) is defined as the integral of t^(x-1) * e^-t dt from t = 0 to t = infinity,
65
+ * and gamma(x) = (x - 1)! for nonnegative integer x, so the factorial for non-whole numbers is defined using the gamma function.
66
+ */
67
+ gamma(): PowiainaNum;
68
+ static gamma(x: PowiainaNumSource): PowiainaNum;
69
+ /**
70
+ * The Lambert W function, also called the omega function or product logarithm, is the solution W(x) === x*e^x.
71
+ * https://en.wikipedia.org/wiki/Lambert_W_function
72
+ *
73
+ * This is a multi-valued function in the complex plane, but only two branches matter for real numbers: the "principal branch" W0, and the "non-principal branch" W_-1.
74
+ * W_0 works for any number >= -1/e, but W_-1 only works for nonpositive numbers >= -1/e.
75
+ * The "principal" parameter, which is true by default, decides which branch we're looking for: W_0 is used if principal is true, W_-1 is used if principal is false.
76
+ */
77
+ lambertw(princ?: boolean): PowiainaNum;
78
+ static lambertw(x: PowiainaNumSource, principal?: boolean): PowiainaNum;
79
+ static tetrate_10(other2: PowiainaNumSource): PowiainaNum;
80
+ max(x: PowiainaNumSource): PowiainaNum;
81
+ min(x: PowiainaNumSource): PowiainaNum;
82
+ maxabs(x: PowiainaNumSource): PowiainaNum;
83
+ minabs(x: PowiainaNumSource): PowiainaNum;
84
+ cmpabs(x: PowiainaNumSource): -1 | 0 | 1 | 2;
85
+ neg(): PowiainaNum;
86
+ rec(): PowiainaNum;
87
+ floor(): PowiainaNum;
88
+ ceil(): PowiainaNum;
89
+ round(): PowiainaNum;
90
+ /**
91
+ * Work like `Math.trunc`,
92
+ *
93
+ * if `this > 0`, return `floor(this)`
94
+ *
95
+ * if `this < 0`, return `ceil(this)`
96
+ *
97
+ * @example
98
+ * new PowiainaNum(3.3).trunc() == new PowiainaNum(3)
99
+ * new PowiainaNum(-1.114514).trunc() == new PowiainaNum(-1)
100
+ * @returns
101
+ */
102
+ trunc(): PowiainaNum;
103
+ /**
104
+ * @returns if this<other, return -1, if this=other, return 0, if this>other, return 1, if this!<=>, return 2
105
+ */
106
+ compare(x: PowiainaNumSource): -1 | 0 | 1 | 2;
107
+ cmp(other: PowiainaNumSource): -1 | 0 | 1 | 2;
108
+ eq(other: PowiainaNumSource): boolean;
109
+ neq(other: PowiainaNumSource): boolean;
110
+ lt(other: PowiainaNumSource): boolean;
111
+ lte(other: PowiainaNumSource): boolean;
112
+ gt(other: PowiainaNumSource): boolean;
113
+ gte(other: PowiainaNumSource): boolean;
114
+ isNaN(): boolean;
115
+ isZero(): boolean;
116
+ isFinite(): boolean;
117
+ isInfi(): boolean;
118
+ isInfiNaN(): boolean;
119
+ isInt(): boolean;
120
+ ispos(): boolean;
121
+ isneg(): boolean;
122
+ static isNaN(x: PowiainaNumSource): boolean;
123
+ /**
124
+ * Normalize functions will make this number convert into standard format.(it also change `this`, like [].sort)
125
+ * @returns normalized number
126
+ */
127
+ normalize(): PowiainaNum;
128
+ /**
129
+ * @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.
130
+ */
131
+ getOperatorIndex(arrow: number, expans?: number, megota?: number): number;
132
+ /**
133
+ * @returns number repeats of operators with given arguments.
134
+ */
135
+ getOperator(arrow: number, expans?: number, megota?: number): number;
136
+ /**
137
+ * Modify the repeat of operator
138
+ * @param number val the repeat of operator will modify to array.
139
+ * @returns bool Is the operators array changed?
140
+ */
141
+ setOperator(val: number, arrow: number, expans?: number, megota?: number): boolean;
142
+ /**
143
+ * @returns a PowiainaNum object which deep copied from `this` object.
144
+ */
145
+ clone(): PowiainaNum;
146
+ resetFromObject(powlikeObject: IPowiainaNum): this;
147
+ /**
148
+ * Convert `this` to Javascript `number`
149
+ *
150
+ * returns `Infinity` when the number is greater than `Number.MAX_VALUE`
151
+ */
152
+ toNumber(): number;
153
+ /**
154
+ * Convert `this` to a string
155
+ */
156
+ toString(): string;
157
+ static fromNumber(x: number): PowiainaNum;
158
+ /**
159
+ * Convert `this` to a JSON object
160
+ * @returns a JSON object
161
+ */
162
+ toJSON(): string;
163
+ static fromString(input: string): PowiainaNum;
164
+ static fromObject(powlikeObject: IPowiainaNum | ExpantaNumArray): PowiainaNum;
165
+ /**
166
+ * A property arary value for version 0.1.x PowiainaNum.
167
+ */
168
+ get arr01(): [number, ...([number, number, number, number] | ["x", number, number, number] | [number, number, "x", number])[]];
169
+ static readonly ZERO: PowiainaNum;
170
+ static readonly ONE: PowiainaNum;
171
+ static readonly MSI: PowiainaNum;
172
+ static readonly MSI_REC: PowiainaNum;
173
+ static readonly E_MSI: PowiainaNum;
174
+ static readonly E_MSI_REC: PowiainaNum;
175
+ static readonly TETRATED_MSI: PowiainaNum;
176
+ static readonly PENTATED_MSI: PowiainaNum;
177
+ static readonly TRITRI: PowiainaNum;
178
+ static readonly GRAHAMS_NUMBER: PowiainaNum;
179
+ static readonly POSITIVE_INFINITY: PowiainaNum;
180
+ static readonly NEGATIVE_INFINITY: PowiainaNum;
181
+ static readonly NaN: PowiainaNum;
182
+ static readonly maxOps = 100;
183
+ }
184
+ export {};
package/package.json CHANGED
@@ -1,47 +1,47 @@
1
- {
2
- "name": "powiaina_num.js",
3
- "version": "0.2.0-alpha.2.8",
4
- "description": "A JavaScript library that handles arithmetic for numbers as large as {10,9e15,1,1,1,2}.",
5
- "type": "module",
6
- "main": "dist/PowiainaNum.js",
7
- "module": "dist/PowiainaNum.esm.js",
8
- "exports": {
9
- "import": "./dist/PowiainaNum.esm.js",
10
- "require": "./dist/PowiainaNum.js",
11
- "types": "./dist/index.d.ts"
12
- },
13
- "unpkg": "dist/PowiainaNum.min.js",
14
- "types": "dist/index.d.ts",
15
- "scripts": {
16
- "build": "bili",
17
- "prepublishOnly": "npm run build",
18
- "test": "echo \"Error: no test specified\" && exit 1",
19
- "fix": "prettier --write ."
20
- },
21
- "repository": {
22
- "type": "git",
23
- "url": "git+https://github.com/VeryrrDefine/PowiainaNum.js.git"
24
- },
25
- "keywords": [
26
- "bignum",
27
- "bignumber",
28
- "bigdecimal",
29
- "number",
30
- "decimal"
31
- ],
32
- "files": [
33
- "dist"
34
- ],
35
- "author": "VeryrrDefine",
36
- "license": "MIT",
37
- "bugs": {
38
- "url": "https://github.com/VeryrrDefine/PowiainaNum.js/issues"
39
- },
40
- "homepage": "https://github.com/VeryrrDefine/PowiainaNum.js#readme",
41
- "devDependencies": {
42
- "prettier": "^3.6.2",
43
- "rollup-plugin-typescript2": "^0.36.0",
44
- "typescript": "^5.8.3",
45
- "bili": "^5.0.5"
46
- }
47
- }
1
+ {
2
+ "name": "powiaina_num.js",
3
+ "version": "0.2.0-alpha.3",
4
+ "description": "A JavaScript library that handles arithmetic for numbers as large as {10,9e15,1,1,1,2}.",
5
+ "type": "module",
6
+ "main": "dist/PowiainaNum.cjs.js",
7
+ "module": "dist/PowiainaNum.esm.js",
8
+ "exports": {
9
+ "import": "./dist/PowiainaNum.esm.js",
10
+ "require": "./dist/PowiainaNum.cjs.js",
11
+ "types": "./dist/index.d.ts"
12
+ },
13
+ "unpkg": "dist/PowiainaNum.min.js",
14
+ "types": "dist/index.d.ts",
15
+ "scripts": {
16
+ "build": "bili",
17
+ "prepublishOnly": "npm run build",
18
+ "test": "echo \"Error: no test specified\" && exit 1",
19
+ "fix": "prettier --write ."
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/VeryrrDefine/PowiainaNum.js.git"
24
+ },
25
+ "keywords": [
26
+ "bignum",
27
+ "bignumber",
28
+ "bigdecimal",
29
+ "number",
30
+ "decimal"
31
+ ],
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "author": "VeryrrDefine",
36
+ "license": "MIT",
37
+ "bugs": {
38
+ "url": "https://github.com/VeryrrDefine/PowiainaNum.js/issues"
39
+ },
40
+ "homepage": "https://github.com/VeryrrDefine/PowiainaNum.js#readme",
41
+ "devDependencies": {
42
+ "prettier": "^3.6.2",
43
+ "rollup-plugin-typescript2": "^0.36.0",
44
+ "typescript": "^5.8.3",
45
+ "bili": "^5.0.5"
46
+ }
47
+ }