@machine202502/types 1.0.0
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 +102 -0
- package/dist/boolean/boolean.d.ts +13 -0
- package/dist/common/types.d.ts +7 -0
- package/dist/math/index.d.ts +3 -0
- package/dist/math/internal.d.ts +13 -0
- package/dist/number/number.d.ts +19 -0
- package/dist/number-integer/number-integer-arithmetic.d.ts +95 -0
- package/dist/number-integer/number-integer-compare.d.ts +27 -0
- package/dist/number-uint-string/number-uint-string-arithmetic-add.d.ts +222 -0
- package/dist/number-uint-string/number-uint-string-arithmetic-divide.d.ts +13 -0
- package/dist/number-uint-string/number-uint-string-arithmetic-half.d.ts +1522 -0
- package/dist/number-uint-string/number-uint-string-arithmetic-multiply.d.ts +140 -0
- package/dist/number-uint-string/number-uint-string-arithmetic-power.d.ts +6 -0
- package/dist/number-uint-string/number-uint-string-arithmetic-subtract.d.ts +222 -0
- package/dist/number-uint-string/number-uint-string-common.d.ts +2 -0
- package/dist/number-uint-string/number-uint-string-compare.d.ts +117 -0
- package/dist/number-uint-string/number-uint-string-conversion.d.ts +15 -0
- package/dist/number-uint-string/number-uint-string-trim.d.ts +3 -0
- package/dist/number-uint-string/number-uint-string-zarr-maps.d.ts +473 -0
- package/dist/number-uint-string/number-uint-string-zarr.d.ts +19 -0
- package/dist/string/string.d.ts +4 -0
- package/package.json +62 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { NumericalDigitChar, NumericalUintStringTuple } from "../common/types";
|
|
2
|
+
import { NumberUintAddMap, NumberUintStringTupleAdd } from "./number-uint-string-arithmetic-add";
|
|
3
|
+
interface NumberUintMultiplyMap {
|
|
4
|
+
"0,0": ["0", "0"];
|
|
5
|
+
"0,1": ["0", "0"];
|
|
6
|
+
"0,2": ["0", "0"];
|
|
7
|
+
"0,3": ["0", "0"];
|
|
8
|
+
"0,4": ["0", "0"];
|
|
9
|
+
"0,5": ["0", "0"];
|
|
10
|
+
"0,6": ["0", "0"];
|
|
11
|
+
"0,7": ["0", "0"];
|
|
12
|
+
"0,8": ["0", "0"];
|
|
13
|
+
"0,9": ["0", "0"];
|
|
14
|
+
"1,0": ["0", "0"];
|
|
15
|
+
"1,1": ["0", "1"];
|
|
16
|
+
"1,2": ["0", "2"];
|
|
17
|
+
"1,3": ["0", "3"];
|
|
18
|
+
"1,4": ["0", "4"];
|
|
19
|
+
"1,5": ["0", "5"];
|
|
20
|
+
"1,6": ["0", "6"];
|
|
21
|
+
"1,7": ["0", "7"];
|
|
22
|
+
"1,8": ["0", "8"];
|
|
23
|
+
"1,9": ["0", "9"];
|
|
24
|
+
"2,0": ["0", "0"];
|
|
25
|
+
"2,1": ["0", "2"];
|
|
26
|
+
"2,2": ["0", "4"];
|
|
27
|
+
"2,3": ["0", "6"];
|
|
28
|
+
"2,4": ["0", "8"];
|
|
29
|
+
"2,5": ["1", "0"];
|
|
30
|
+
"2,6": ["1", "2"];
|
|
31
|
+
"2,7": ["1", "4"];
|
|
32
|
+
"2,8": ["1", "6"];
|
|
33
|
+
"2,9": ["1", "8"];
|
|
34
|
+
"3,0": ["0", "0"];
|
|
35
|
+
"3,1": ["0", "3"];
|
|
36
|
+
"3,2": ["0", "6"];
|
|
37
|
+
"3,3": ["0", "9"];
|
|
38
|
+
"3,4": ["1", "2"];
|
|
39
|
+
"3,5": ["1", "5"];
|
|
40
|
+
"3,6": ["1", "8"];
|
|
41
|
+
"3,7": ["2", "1"];
|
|
42
|
+
"3,8": ["2", "4"];
|
|
43
|
+
"3,9": ["2", "7"];
|
|
44
|
+
"4,0": ["0", "0"];
|
|
45
|
+
"4,1": ["0", "4"];
|
|
46
|
+
"4,2": ["0", "8"];
|
|
47
|
+
"4,3": ["1", "2"];
|
|
48
|
+
"4,4": ["1", "6"];
|
|
49
|
+
"4,5": ["2", "0"];
|
|
50
|
+
"4,6": ["2", "4"];
|
|
51
|
+
"4,7": ["2", "8"];
|
|
52
|
+
"4,8": ["3", "2"];
|
|
53
|
+
"4,9": ["3", "6"];
|
|
54
|
+
"5,0": ["0", "0"];
|
|
55
|
+
"5,1": ["0", "5"];
|
|
56
|
+
"5,2": ["1", "0"];
|
|
57
|
+
"5,3": ["1", "5"];
|
|
58
|
+
"5,4": ["2", "0"];
|
|
59
|
+
"5,5": ["2", "5"];
|
|
60
|
+
"5,6": ["3", "0"];
|
|
61
|
+
"5,7": ["3", "5"];
|
|
62
|
+
"5,8": ["4", "0"];
|
|
63
|
+
"5,9": ["4", "5"];
|
|
64
|
+
"6,0": ["0", "0"];
|
|
65
|
+
"6,1": ["0", "6"];
|
|
66
|
+
"6,2": ["1", "2"];
|
|
67
|
+
"6,3": ["1", "8"];
|
|
68
|
+
"6,4": ["2", "4"];
|
|
69
|
+
"6,5": ["3", "0"];
|
|
70
|
+
"6,6": ["3", "6"];
|
|
71
|
+
"6,7": ["4", "2"];
|
|
72
|
+
"6,8": ["4", "8"];
|
|
73
|
+
"6,9": ["5", "4"];
|
|
74
|
+
"7,0": ["0", "0"];
|
|
75
|
+
"7,1": ["0", "7"];
|
|
76
|
+
"7,2": ["1", "4"];
|
|
77
|
+
"7,3": ["2", "1"];
|
|
78
|
+
"7,4": ["2", "8"];
|
|
79
|
+
"7,5": ["3", "5"];
|
|
80
|
+
"7,6": ["4", "2"];
|
|
81
|
+
"7,7": ["4", "9"];
|
|
82
|
+
"7,8": ["5", "6"];
|
|
83
|
+
"7,9": ["6", "3"];
|
|
84
|
+
"8,0": ["0", "0"];
|
|
85
|
+
"8,1": ["0", "8"];
|
|
86
|
+
"8,2": ["1", "6"];
|
|
87
|
+
"8,3": ["2", "4"];
|
|
88
|
+
"8,4": ["3", "2"];
|
|
89
|
+
"8,5": ["4", "0"];
|
|
90
|
+
"8,6": ["4", "8"];
|
|
91
|
+
"8,7": ["5", "6"];
|
|
92
|
+
"8,8": ["6", "4"];
|
|
93
|
+
"8,9": ["7", "2"];
|
|
94
|
+
"9,0": ["0", "0"];
|
|
95
|
+
"9,1": ["0", "9"];
|
|
96
|
+
"9,2": ["1", "8"];
|
|
97
|
+
"9,3": ["2", "7"];
|
|
98
|
+
"9,4": ["3", "6"];
|
|
99
|
+
"9,5": ["4", "5"];
|
|
100
|
+
"9,6": ["5", "4"];
|
|
101
|
+
"9,7": ["6", "3"];
|
|
102
|
+
"9,8": ["7", "2"];
|
|
103
|
+
"9,9": ["8", "1"];
|
|
104
|
+
}
|
|
105
|
+
type _NumberUintStringTupleMultiplyOnDigit<LNT extends NumericalUintStringTuple, RD extends NumericalDigitChar, ResultNT extends NumericalUintStringTuple, ResultChargeDigit extends NumericalDigitChar> = LNT extends [] ? [ResultChargeDigit, ...ResultNT] : LNT extends [
|
|
106
|
+
...infer LNTRest extends NumericalUintStringTuple,
|
|
107
|
+
infer LNTDigit extends NumericalDigitChar
|
|
108
|
+
] ? NumberUintMultiplyMap[`${LNTDigit},${RD}`] extends [
|
|
109
|
+
infer MultiplySecondCharge extends NumericalDigitChar,
|
|
110
|
+
infer MultiplyFirstCharge extends NumericalDigitChar
|
|
111
|
+
] ? NumberUintAddMap[`${MultiplyFirstCharge},${ResultChargeDigit},0`] extends [
|
|
112
|
+
infer AddCharge extends NumericalDigitChar,
|
|
113
|
+
infer AddDigit extends NumericalDigitChar
|
|
114
|
+
] ? NumberUintAddMap[`${MultiplySecondCharge},${AddCharge},0`][1] extends infer TwoAddSecondCharge extends NumericalDigitChar ? _NumberUintStringTupleMultiplyOnDigit<LNTRest, RD, [
|
|
115
|
+
AddDigit,
|
|
116
|
+
...ResultNT
|
|
117
|
+
], TwoAddSecondCharge> : [] : [] : [] : [];
|
|
118
|
+
type NumberUintStringTupleMultiplyOnDigit<LNT extends NumericalUintStringTuple, RD extends NumericalDigitChar> = _NumberUintStringTupleMultiplyOnDigit<LNT, RD, [], "0">;
|
|
119
|
+
type _NumberUintStringTupleMultiplyOnEachDigit<LNT extends NumericalUintStringTuple, RNT extends NumericalUintStringTuple, Zarr extends "0"[], ResultNT extends NumericalUintStringTuple[]> = RNT extends [
|
|
120
|
+
...infer RNTRest extends NumericalUintStringTuple,
|
|
121
|
+
infer RNTDigit extends NumericalDigitChar
|
|
122
|
+
] ? _NumberUintStringTupleMultiplyOnEachDigit<LNT, RNTRest, [
|
|
123
|
+
"0",
|
|
124
|
+
...Zarr
|
|
125
|
+
], [
|
|
126
|
+
...ResultNT,
|
|
127
|
+
[
|
|
128
|
+
...NumberUintStringTupleMultiplyOnDigit<LNT, RNTDigit>,
|
|
129
|
+
...Zarr
|
|
130
|
+
]
|
|
131
|
+
]> : ResultNT;
|
|
132
|
+
type NumberUintStringTupleMultiplyOnEachDigit<LNT extends NumericalUintStringTuple, RNT extends NumericalUintStringTuple> = _NumberUintStringTupleMultiplyOnEachDigit<LNT, RNT, [], []>;
|
|
133
|
+
type _NumberUintStringTupleAllSum<ANT extends NumericalUintStringTuple[], ResultNT extends NumericalUintStringTuple> = ANT extends [
|
|
134
|
+
...infer ANTRest extends NumericalUintStringTuple[],
|
|
135
|
+
infer NT extends NumericalUintStringTuple
|
|
136
|
+
] ? _NumberUintStringTupleAllSum<ANTRest, NumberUintStringTupleAdd<ResultNT, NT>> : ResultNT;
|
|
137
|
+
type NumberUintStringTupleMultiply<LNT extends NumericalUintStringTuple, RNT extends NumericalUintStringTuple> = _NumberUintStringTupleAllSum<NumberUintStringTupleMultiplyOnEachDigit<LNT, RNT>, [
|
|
138
|
+
]>;
|
|
139
|
+
export { NumberUintStringTupleMultiplyOnDigit, NumberUintStringTupleMultiplyOnEachDigit, };
|
|
140
|
+
export { NumberUintMultiplyMap, NumberUintStringTupleMultiply };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NumericalUintStringTuple } from "../common/types";
|
|
2
|
+
import { NumberUintStringTupleMultiply } from "./number-uint-string-arithmetic-multiply";
|
|
3
|
+
import { NumberUintStringZeroLeftTrim } from "./number-uint-string-trim";
|
|
4
|
+
type _NumberUintStringTuplePower<RNT extends NumericalUintStringTuple, Zarr extends "0"[], SNT extends NumericalUintStringTuple> = Zarr extends ["0", ...infer ZarrRest extends "0"[]] ? _NumberUintStringTuplePower<NumberUintStringZeroLeftTrim<NumberUintStringTupleMultiply<SNT, RNT>>, ZarrRest, SNT> : RNT;
|
|
5
|
+
type NumberUintStringTuplePower<NT extends NumericalUintStringTuple, Zarr extends "0"[]> = _NumberUintStringTuplePower<["1"], Zarr, NT>;
|
|
6
|
+
export { NumberUintStringTuplePower };
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { NumericalDigitChar, NumericalUintStringTuple } from "../common/types";
|
|
2
|
+
import { NumberUintCharge } from "./number-uint-string-common";
|
|
3
|
+
interface NumberUintSubtractMap {
|
|
4
|
+
"0,0,0": ["0", "0"];
|
|
5
|
+
"0,0,1": ["1", "9"];
|
|
6
|
+
"0,1,0": ["1", "9"];
|
|
7
|
+
"0,1,1": ["1", "8"];
|
|
8
|
+
"0,2,0": ["1", "8"];
|
|
9
|
+
"0,2,1": ["1", "7"];
|
|
10
|
+
"0,3,0": ["1", "7"];
|
|
11
|
+
"0,3,1": ["1", "6"];
|
|
12
|
+
"0,4,0": ["1", "6"];
|
|
13
|
+
"0,4,1": ["1", "5"];
|
|
14
|
+
"0,5,0": ["1", "5"];
|
|
15
|
+
"0,5,1": ["1", "4"];
|
|
16
|
+
"0,6,0": ["1", "4"];
|
|
17
|
+
"0,6,1": ["1", "3"];
|
|
18
|
+
"0,7,0": ["1", "3"];
|
|
19
|
+
"0,7,1": ["1", "2"];
|
|
20
|
+
"0,8,0": ["1", "2"];
|
|
21
|
+
"0,8,1": ["1", "1"];
|
|
22
|
+
"0,9,0": ["1", "1"];
|
|
23
|
+
"0,9,1": ["1", "0"];
|
|
24
|
+
"1,0,0": ["0", "1"];
|
|
25
|
+
"1,0,1": ["0", "0"];
|
|
26
|
+
"1,1,0": ["0", "0"];
|
|
27
|
+
"1,1,1": ["1", "9"];
|
|
28
|
+
"1,2,0": ["1", "9"];
|
|
29
|
+
"1,2,1": ["1", "8"];
|
|
30
|
+
"1,3,0": ["1", "8"];
|
|
31
|
+
"1,3,1": ["1", "7"];
|
|
32
|
+
"1,4,0": ["1", "7"];
|
|
33
|
+
"1,4,1": ["1", "6"];
|
|
34
|
+
"1,5,0": ["1", "6"];
|
|
35
|
+
"1,5,1": ["1", "5"];
|
|
36
|
+
"1,6,0": ["1", "5"];
|
|
37
|
+
"1,6,1": ["1", "4"];
|
|
38
|
+
"1,7,0": ["1", "4"];
|
|
39
|
+
"1,7,1": ["1", "3"];
|
|
40
|
+
"1,8,0": ["1", "3"];
|
|
41
|
+
"1,8,1": ["1", "2"];
|
|
42
|
+
"1,9,0": ["1", "2"];
|
|
43
|
+
"1,9,1": ["1", "1"];
|
|
44
|
+
"2,0,0": ["0", "2"];
|
|
45
|
+
"2,0,1": ["0", "1"];
|
|
46
|
+
"2,1,0": ["0", "1"];
|
|
47
|
+
"2,1,1": ["0", "0"];
|
|
48
|
+
"2,2,0": ["0", "0"];
|
|
49
|
+
"2,2,1": ["1", "9"];
|
|
50
|
+
"2,3,0": ["1", "9"];
|
|
51
|
+
"2,3,1": ["1", "8"];
|
|
52
|
+
"2,4,0": ["1", "8"];
|
|
53
|
+
"2,4,1": ["1", "7"];
|
|
54
|
+
"2,5,0": ["1", "7"];
|
|
55
|
+
"2,5,1": ["1", "6"];
|
|
56
|
+
"2,6,0": ["1", "6"];
|
|
57
|
+
"2,6,1": ["1", "5"];
|
|
58
|
+
"2,7,0": ["1", "5"];
|
|
59
|
+
"2,7,1": ["1", "4"];
|
|
60
|
+
"2,8,0": ["1", "4"];
|
|
61
|
+
"2,8,1": ["1", "3"];
|
|
62
|
+
"2,9,0": ["1", "3"];
|
|
63
|
+
"2,9,1": ["1", "2"];
|
|
64
|
+
"3,0,0": ["0", "3"];
|
|
65
|
+
"3,0,1": ["0", "2"];
|
|
66
|
+
"3,1,0": ["0", "2"];
|
|
67
|
+
"3,1,1": ["0", "1"];
|
|
68
|
+
"3,2,0": ["0", "1"];
|
|
69
|
+
"3,2,1": ["0", "0"];
|
|
70
|
+
"3,3,0": ["0", "0"];
|
|
71
|
+
"3,3,1": ["1", "9"];
|
|
72
|
+
"3,4,0": ["1", "9"];
|
|
73
|
+
"3,4,1": ["1", "8"];
|
|
74
|
+
"3,5,0": ["1", "8"];
|
|
75
|
+
"3,5,1": ["1", "7"];
|
|
76
|
+
"3,6,0": ["1", "7"];
|
|
77
|
+
"3,6,1": ["1", "6"];
|
|
78
|
+
"3,7,0": ["1", "6"];
|
|
79
|
+
"3,7,1": ["1", "5"];
|
|
80
|
+
"3,8,0": ["1", "5"];
|
|
81
|
+
"3,8,1": ["1", "4"];
|
|
82
|
+
"3,9,0": ["1", "4"];
|
|
83
|
+
"3,9,1": ["1", "3"];
|
|
84
|
+
"4,0,0": ["0", "4"];
|
|
85
|
+
"4,0,1": ["0", "3"];
|
|
86
|
+
"4,1,0": ["0", "3"];
|
|
87
|
+
"4,1,1": ["0", "2"];
|
|
88
|
+
"4,2,0": ["0", "2"];
|
|
89
|
+
"4,2,1": ["0", "1"];
|
|
90
|
+
"4,3,0": ["0", "1"];
|
|
91
|
+
"4,3,1": ["0", "0"];
|
|
92
|
+
"4,4,0": ["0", "0"];
|
|
93
|
+
"4,4,1": ["1", "9"];
|
|
94
|
+
"4,5,0": ["1", "9"];
|
|
95
|
+
"4,5,1": ["1", "8"];
|
|
96
|
+
"4,6,0": ["1", "8"];
|
|
97
|
+
"4,6,1": ["1", "7"];
|
|
98
|
+
"4,7,0": ["1", "7"];
|
|
99
|
+
"4,7,1": ["1", "6"];
|
|
100
|
+
"4,8,0": ["1", "6"];
|
|
101
|
+
"4,8,1": ["1", "5"];
|
|
102
|
+
"4,9,0": ["1", "5"];
|
|
103
|
+
"4,9,1": ["1", "4"];
|
|
104
|
+
"5,0,0": ["0", "5"];
|
|
105
|
+
"5,0,1": ["0", "4"];
|
|
106
|
+
"5,1,0": ["0", "4"];
|
|
107
|
+
"5,1,1": ["0", "3"];
|
|
108
|
+
"5,2,0": ["0", "3"];
|
|
109
|
+
"5,2,1": ["0", "2"];
|
|
110
|
+
"5,3,0": ["0", "2"];
|
|
111
|
+
"5,3,1": ["0", "1"];
|
|
112
|
+
"5,4,0": ["0", "1"];
|
|
113
|
+
"5,4,1": ["0", "0"];
|
|
114
|
+
"5,5,0": ["0", "0"];
|
|
115
|
+
"5,5,1": ["1", "9"];
|
|
116
|
+
"5,6,0": ["1", "9"];
|
|
117
|
+
"5,6,1": ["1", "8"];
|
|
118
|
+
"5,7,0": ["1", "8"];
|
|
119
|
+
"5,7,1": ["1", "7"];
|
|
120
|
+
"5,8,0": ["1", "7"];
|
|
121
|
+
"5,8,1": ["1", "6"];
|
|
122
|
+
"5,9,0": ["1", "6"];
|
|
123
|
+
"5,9,1": ["1", "5"];
|
|
124
|
+
"6,0,0": ["0", "6"];
|
|
125
|
+
"6,0,1": ["0", "5"];
|
|
126
|
+
"6,1,0": ["0", "5"];
|
|
127
|
+
"6,1,1": ["0", "4"];
|
|
128
|
+
"6,2,0": ["0", "4"];
|
|
129
|
+
"6,2,1": ["0", "3"];
|
|
130
|
+
"6,3,0": ["0", "3"];
|
|
131
|
+
"6,3,1": ["0", "2"];
|
|
132
|
+
"6,4,0": ["0", "2"];
|
|
133
|
+
"6,4,1": ["0", "1"];
|
|
134
|
+
"6,5,0": ["0", "1"];
|
|
135
|
+
"6,5,1": ["0", "0"];
|
|
136
|
+
"6,6,0": ["0", "0"];
|
|
137
|
+
"6,6,1": ["1", "9"];
|
|
138
|
+
"6,7,0": ["1", "9"];
|
|
139
|
+
"6,7,1": ["1", "8"];
|
|
140
|
+
"6,8,0": ["1", "8"];
|
|
141
|
+
"6,8,1": ["1", "7"];
|
|
142
|
+
"6,9,0": ["1", "7"];
|
|
143
|
+
"6,9,1": ["1", "6"];
|
|
144
|
+
"7,0,0": ["0", "7"];
|
|
145
|
+
"7,0,1": ["0", "6"];
|
|
146
|
+
"7,1,0": ["0", "6"];
|
|
147
|
+
"7,1,1": ["0", "5"];
|
|
148
|
+
"7,2,0": ["0", "5"];
|
|
149
|
+
"7,2,1": ["0", "4"];
|
|
150
|
+
"7,3,0": ["0", "4"];
|
|
151
|
+
"7,3,1": ["0", "3"];
|
|
152
|
+
"7,4,0": ["0", "3"];
|
|
153
|
+
"7,4,1": ["0", "2"];
|
|
154
|
+
"7,5,0": ["0", "2"];
|
|
155
|
+
"7,5,1": ["0", "1"];
|
|
156
|
+
"7,6,0": ["0", "1"];
|
|
157
|
+
"7,6,1": ["0", "0"];
|
|
158
|
+
"7,7,0": ["0", "0"];
|
|
159
|
+
"7,7,1": ["1", "9"];
|
|
160
|
+
"7,8,0": ["1", "9"];
|
|
161
|
+
"7,8,1": ["1", "8"];
|
|
162
|
+
"7,9,0": ["1", "8"];
|
|
163
|
+
"7,9,1": ["1", "7"];
|
|
164
|
+
"8,0,0": ["0", "8"];
|
|
165
|
+
"8,0,1": ["0", "7"];
|
|
166
|
+
"8,1,0": ["0", "7"];
|
|
167
|
+
"8,1,1": ["0", "6"];
|
|
168
|
+
"8,2,0": ["0", "6"];
|
|
169
|
+
"8,2,1": ["0", "5"];
|
|
170
|
+
"8,3,0": ["0", "5"];
|
|
171
|
+
"8,3,1": ["0", "4"];
|
|
172
|
+
"8,4,0": ["0", "4"];
|
|
173
|
+
"8,4,1": ["0", "3"];
|
|
174
|
+
"8,5,0": ["0", "3"];
|
|
175
|
+
"8,5,1": ["0", "2"];
|
|
176
|
+
"8,6,0": ["0", "2"];
|
|
177
|
+
"8,6,1": ["0", "1"];
|
|
178
|
+
"8,7,0": ["0", "1"];
|
|
179
|
+
"8,7,1": ["0", "0"];
|
|
180
|
+
"8,8,0": ["0", "0"];
|
|
181
|
+
"8,8,1": ["1", "9"];
|
|
182
|
+
"8,9,0": ["1", "9"];
|
|
183
|
+
"8,9,1": ["1", "8"];
|
|
184
|
+
"9,0,0": ["0", "9"];
|
|
185
|
+
"9,0,1": ["0", "8"];
|
|
186
|
+
"9,1,0": ["0", "8"];
|
|
187
|
+
"9,1,1": ["0", "7"];
|
|
188
|
+
"9,2,0": ["0", "7"];
|
|
189
|
+
"9,2,1": ["0", "6"];
|
|
190
|
+
"9,3,0": ["0", "6"];
|
|
191
|
+
"9,3,1": ["0", "5"];
|
|
192
|
+
"9,4,0": ["0", "5"];
|
|
193
|
+
"9,4,1": ["0", "4"];
|
|
194
|
+
"9,5,0": ["0", "4"];
|
|
195
|
+
"9,5,1": ["0", "3"];
|
|
196
|
+
"9,6,0": ["0", "3"];
|
|
197
|
+
"9,6,1": ["0", "2"];
|
|
198
|
+
"9,7,0": ["0", "2"];
|
|
199
|
+
"9,7,1": ["0", "1"];
|
|
200
|
+
"9,8,0": ["0", "1"];
|
|
201
|
+
"9,8,1": ["0", "0"];
|
|
202
|
+
"9,9,0": ["0", "0"];
|
|
203
|
+
"9,9,1": ["1", "9"];
|
|
204
|
+
}
|
|
205
|
+
type _NumberUintStringTupleSubtract<LNT extends NumericalUintStringTuple, RNT extends NumericalUintStringTuple, ResultNT extends NumericalUintStringTuple, ResultCharge extends NumberUintCharge> = [LNT, RNT] extends [
|
|
206
|
+
[
|
|
207
|
+
...infer LNTRest extends NumericalUintStringTuple,
|
|
208
|
+
infer LNTDigit extends NumericalDigitChar
|
|
209
|
+
],
|
|
210
|
+
[
|
|
211
|
+
...infer RNTRest extends NumericalUintStringTuple,
|
|
212
|
+
infer RNTDigit extends NumericalDigitChar
|
|
213
|
+
]
|
|
214
|
+
] ? NumberUintSubtractMap[`${LNTDigit},${RNTDigit},${ResultCharge}`] extends [
|
|
215
|
+
infer SubtractCharge extends NumberUintCharge,
|
|
216
|
+
infer SubtractDigit extends NumericalDigitChar
|
|
217
|
+
] ? _NumberUintStringTupleSubtract<LNTRest, RNTRest, [
|
|
218
|
+
SubtractDigit,
|
|
219
|
+
...ResultNT
|
|
220
|
+
], SubtractCharge> : [] : ResultCharge extends "0" ? [...LNT, ...RNT, ...ResultNT] : LNT extends [] ? [] : _NumberUintStringTupleSubtract<[...LNT, ...RNT], ["1"], ResultNT, "0">;
|
|
221
|
+
type NumberUintStringTupleSubtract<LNT extends NumericalUintStringTuple, RNT extends NumericalUintStringTuple> = _NumberUintStringTupleSubtract<LNT, RNT, [], "0">;
|
|
222
|
+
export { NumberUintSubtractMap, NumberUintStringTupleSubtract };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { NumericalCompared, NumericalDigitChar, NumericalUintStringTuple } from "../common/types";
|
|
2
|
+
import { NumberUintStringZeroLeftTrim } from "./number-uint-string-trim";
|
|
3
|
+
interface NumberUintStringCompareMap {
|
|
4
|
+
"0,0": 0;
|
|
5
|
+
"0,1": -1;
|
|
6
|
+
"0,2": -1;
|
|
7
|
+
"0,3": -1;
|
|
8
|
+
"0,4": -1;
|
|
9
|
+
"0,5": -1;
|
|
10
|
+
"0,6": -1;
|
|
11
|
+
"0,7": -1;
|
|
12
|
+
"0,8": -1;
|
|
13
|
+
"0,9": -1;
|
|
14
|
+
"1,0": 1;
|
|
15
|
+
"1,1": 0;
|
|
16
|
+
"1,2": -1;
|
|
17
|
+
"1,3": -1;
|
|
18
|
+
"1,4": -1;
|
|
19
|
+
"1,5": -1;
|
|
20
|
+
"1,6": -1;
|
|
21
|
+
"1,7": -1;
|
|
22
|
+
"1,8": -1;
|
|
23
|
+
"1,9": -1;
|
|
24
|
+
"2,0": 1;
|
|
25
|
+
"2,1": 1;
|
|
26
|
+
"2,2": 0;
|
|
27
|
+
"2,3": -1;
|
|
28
|
+
"2,4": -1;
|
|
29
|
+
"2,5": -1;
|
|
30
|
+
"2,6": -1;
|
|
31
|
+
"2,7": -1;
|
|
32
|
+
"2,8": -1;
|
|
33
|
+
"2,9": -1;
|
|
34
|
+
"3,0": 1;
|
|
35
|
+
"3,1": 1;
|
|
36
|
+
"3,2": 1;
|
|
37
|
+
"3,3": 0;
|
|
38
|
+
"3,4": -1;
|
|
39
|
+
"3,5": -1;
|
|
40
|
+
"3,6": -1;
|
|
41
|
+
"3,7": -1;
|
|
42
|
+
"3,8": -1;
|
|
43
|
+
"3,9": -1;
|
|
44
|
+
"4,0": 1;
|
|
45
|
+
"4,1": 1;
|
|
46
|
+
"4,2": 1;
|
|
47
|
+
"4,3": 1;
|
|
48
|
+
"4,4": 0;
|
|
49
|
+
"4,5": -1;
|
|
50
|
+
"4,6": -1;
|
|
51
|
+
"4,7": -1;
|
|
52
|
+
"4,8": -1;
|
|
53
|
+
"4,9": -1;
|
|
54
|
+
"5,0": 1;
|
|
55
|
+
"5,1": 1;
|
|
56
|
+
"5,2": 1;
|
|
57
|
+
"5,3": 1;
|
|
58
|
+
"5,4": 1;
|
|
59
|
+
"5,5": 0;
|
|
60
|
+
"5,6": -1;
|
|
61
|
+
"5,7": -1;
|
|
62
|
+
"5,8": -1;
|
|
63
|
+
"5,9": -1;
|
|
64
|
+
"6,0": 1;
|
|
65
|
+
"6,1": 1;
|
|
66
|
+
"6,2": 1;
|
|
67
|
+
"6,3": 1;
|
|
68
|
+
"6,4": 1;
|
|
69
|
+
"6,5": 1;
|
|
70
|
+
"6,6": 0;
|
|
71
|
+
"6,7": -1;
|
|
72
|
+
"6,8": -1;
|
|
73
|
+
"6,9": -1;
|
|
74
|
+
"7,0": 1;
|
|
75
|
+
"7,1": 1;
|
|
76
|
+
"7,2": 1;
|
|
77
|
+
"7,3": 1;
|
|
78
|
+
"7,4": 1;
|
|
79
|
+
"7,5": 1;
|
|
80
|
+
"7,6": 1;
|
|
81
|
+
"7,7": 0;
|
|
82
|
+
"7,8": -1;
|
|
83
|
+
"7,9": -1;
|
|
84
|
+
"8,0": 1;
|
|
85
|
+
"8,1": 1;
|
|
86
|
+
"8,2": 1;
|
|
87
|
+
"8,3": 1;
|
|
88
|
+
"8,4": 1;
|
|
89
|
+
"8,5": 1;
|
|
90
|
+
"8,6": 1;
|
|
91
|
+
"8,7": 1;
|
|
92
|
+
"8,8": 0;
|
|
93
|
+
"8,9": -1;
|
|
94
|
+
"9,0": 1;
|
|
95
|
+
"9,1": 1;
|
|
96
|
+
"9,2": 1;
|
|
97
|
+
"9,3": 1;
|
|
98
|
+
"9,4": 1;
|
|
99
|
+
"9,5": 1;
|
|
100
|
+
"9,6": 1;
|
|
101
|
+
"9,7": 1;
|
|
102
|
+
"9,8": 1;
|
|
103
|
+
"9,9": 0;
|
|
104
|
+
}
|
|
105
|
+
type _NumberUintStringTupleCompare<LNT extends NumericalUintStringTuple, RNT extends NumericalUintStringTuple, BC extends NumericalCompared> = [LNT, RNT] extends [
|
|
106
|
+
[
|
|
107
|
+
...infer LNTRest extends NumericalUintStringTuple,
|
|
108
|
+
infer LNTDigit extends NumericalDigitChar
|
|
109
|
+
],
|
|
110
|
+
[
|
|
111
|
+
...infer RNTRest extends NumericalUintStringTuple,
|
|
112
|
+
infer RNTDigit extends NumericalDigitChar
|
|
113
|
+
]
|
|
114
|
+
] ? NumberUintStringCompareMap[`${LNTDigit},${RNTDigit}`] extends infer RC extends NumericalCompared ? RC extends 0 ? _NumberUintStringTupleCompare<LNTRest, RNTRest, BC> : _NumberUintStringTupleCompare<LNTRest, RNTRest, RC> : BC : NumberUintStringZeroLeftTrim<[...LNT, ...RNT]> extends [] ? BC : RNT extends [] ? 1 : -1;
|
|
115
|
+
type NumberUintStringTupleCompare<LNT extends NumericalUintStringTuple, RNT extends NumericalUintStringTuple> = _NumberUintStringTupleCompare<LNT, RNT, 0>;
|
|
116
|
+
export { NumberUintStringCompareMap };
|
|
117
|
+
export { NumberUintStringTupleCompare };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NumericalSign, NumericalUintStringTuple, NumericalDigitChar } from "../common/types";
|
|
2
|
+
import { Signed, NumberParts } from "../number/number";
|
|
3
|
+
import { StringToTuple } from "../string/string";
|
|
4
|
+
import { NumberUintStringZeroLeftTrim } from "./number-uint-string-trim";
|
|
5
|
+
type NumberUintStringToTuple<N extends number> = NumberParts<N> extends [
|
|
6
|
+
infer NSign extends NumericalSign,
|
|
7
|
+
infer NAbs extends number,
|
|
8
|
+
number
|
|
9
|
+
] ? [sing: NSign, tuple: StringToTuple<`${NAbs}`>] : [0, 0];
|
|
10
|
+
type _NumberUintStringTupleToNumber<NT extends NumericalUintStringTuple, NS extends string> = NT extends [] ? NS extends `${infer N extends number}` ? N : 0 : NT extends [
|
|
11
|
+
infer NTDigit extends NumericalDigitChar,
|
|
12
|
+
...infer NTRest extends NumericalUintStringTuple
|
|
13
|
+
] ? _NumberUintStringTupleToNumber<NTRest, `${NS}${NTDigit}`> : 0;
|
|
14
|
+
type NumberUintStringTupleToNumber<T extends [sign: NumericalSign, tuple: NumericalUintStringTuple]> = Signed<_NumberUintStringTupleToNumber<NumberUintStringZeroLeftTrim<T[1]>, "">, T[0]>;
|
|
15
|
+
export { NumberUintStringToTuple, NumberUintStringTupleToNumber };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { NumericalUintStringTuple } from "../common/types";
|
|
2
|
+
type NumberUintStringZeroLeftTrim<NT extends NumericalUintStringTuple> = NT extends ["0", ...infer NTRest extends NumericalUintStringTuple] ? NumberUintStringZeroLeftTrim<NTRest> : NT extends [] ? [] : NT;
|
|
3
|
+
export { NumberUintStringZeroLeftTrim };
|