@obinexusmk2/hypernum 0.1.0 → 0.1.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.
Files changed (140) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +355 -256
  3. package/dist/index.cjs +4 -8
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +4 -7
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.umd.js +2 -2
  9. package/dist/index.umd.js.map +1 -1
  10. package/dist/types/{config → src/config}/config-loader.d.ts +0 -0
  11. package/dist/types/src/config/config-loader.d.ts.map +1 -0
  12. package/dist/types/{config → src/config}/config-parser.d.ts +0 -0
  13. package/dist/types/src/config/config-parser.d.ts.map +1 -0
  14. package/dist/types/{config → src/config}/config-resolver.d.ts +0 -0
  15. package/dist/types/src/config/config-resolver.d.ts.map +1 -0
  16. package/dist/types/{config → src/config}/config-source.d.ts +0 -0
  17. package/dist/types/src/config/config-source.d.ts.map +1 -0
  18. package/dist/types/{config → src/config}/index.d.ts +0 -0
  19. package/dist/types/src/config/index.d.ts.map +1 -0
  20. package/dist/types/{core → src/core}/common.d.ts +0 -0
  21. package/dist/types/src/core/common.d.ts.map +1 -0
  22. package/dist/types/{core → src/core}/config.d.ts +0 -0
  23. package/dist/types/src/core/config.d.ts.map +1 -0
  24. package/dist/types/{core → src/core}/constants.d.ts +0 -0
  25. package/dist/types/src/core/constants.d.ts.map +1 -0
  26. package/dist/types/{core → src/core}/errors.d.ts +0 -0
  27. package/dist/types/src/core/errors.d.ts.map +1 -0
  28. package/dist/types/{core → src/core}/hypernum.d.ts +0 -0
  29. package/dist/types/src/core/hypernum.d.ts.map +1 -0
  30. package/dist/types/{core → src/core}/index.d.ts +0 -0
  31. package/dist/types/src/core/index.d.ts.map +1 -0
  32. package/dist/types/{index.d.ts → src/index.d.ts} +1 -1
  33. package/dist/types/src/index.d.ts.map +1 -0
  34. package/dist/types/{operations → src/operations}/arithmetic.d.ts +0 -0
  35. package/dist/types/src/operations/arithmetic.d.ts.map +1 -0
  36. package/dist/types/{operations → src/operations}/bitwise.d.ts +0 -0
  37. package/dist/types/src/operations/bitwise.d.ts.map +1 -0
  38. package/dist/types/{operations → src/operations}/comparison.d.ts +0 -0
  39. package/dist/types/src/operations/comparison.d.ts.map +1 -0
  40. package/dist/types/{operations → src/operations}/conversion.d.ts +0 -0
  41. package/dist/types/src/operations/conversion.d.ts.map +1 -0
  42. package/dist/types/{operations → src/operations}/factorial.d.ts +0 -0
  43. package/dist/types/src/operations/factorial.d.ts.map +1 -0
  44. package/dist/types/{operations → src/operations}/index.d.ts +0 -0
  45. package/dist/types/src/operations/index.d.ts.map +1 -0
  46. package/dist/types/{operations → src/operations}/power.d.ts +0 -0
  47. package/dist/types/src/operations/power.d.ts.map +1 -0
  48. package/dist/types/{storage → src/storage}/Heap.d.ts +0 -0
  49. package/dist/types/src/storage/Heap.d.ts.map +1 -0
  50. package/dist/types/{storage → src/storage}/index.d.ts +0 -0
  51. package/dist/types/src/storage/index.d.ts.map +1 -0
  52. package/dist/types/{structures → src/structures}/ackermann.d.ts +0 -0
  53. package/dist/types/src/structures/ackermann.d.ts.map +1 -0
  54. package/dist/types/{structures → src/structures}/big-array.d.ts +0 -0
  55. package/dist/types/src/structures/big-array.d.ts.map +1 -0
  56. package/dist/types/{structures → src/structures}/index.d.ts +0 -0
  57. package/dist/types/src/structures/index.d.ts.map +1 -0
  58. package/dist/types/{structures → src/structures}/number-tree.d.ts +0 -0
  59. package/dist/types/src/structures/number-tree.d.ts.map +1 -0
  60. package/dist/types/{structures → src/structures}/power-tower.d.ts +0 -0
  61. package/dist/types/src/structures/power-tower.d.ts.map +1 -0
  62. package/dist/types/{utils → src/utils}/formatting.d.ts +0 -0
  63. package/dist/types/src/utils/formatting.d.ts.map +1 -0
  64. package/dist/types/{utils → src/utils}/index.d.ts +0 -0
  65. package/dist/types/src/utils/index.d.ts.map +1 -0
  66. package/dist/types/{utils → src/utils}/parser.d.ts +0 -0
  67. package/dist/types/src/utils/parser.d.ts.map +1 -0
  68. package/dist/types/{utils → src/utils}/precision.d.ts +0 -0
  69. package/dist/types/src/utils/precision.d.ts.map +1 -0
  70. package/dist/types/{utils → src/utils}/validation.d.ts +0 -0
  71. package/dist/types/src/utils/validation.d.ts.map +1 -0
  72. package/package.json +169 -164
  73. package/rollup.config.js +163 -161
  74. package/src/cli/hypernum.js +272 -0
  75. package/src/config/config-loader.ts +0 -0
  76. package/src/config/config-parser.ts +160 -160
  77. package/src/config/config-resolver.ts +0 -0
  78. package/src/config/config-source.ts +0 -0
  79. package/src/config/index.ts +0 -0
  80. package/src/core/common.ts +184 -184
  81. package/src/core/config.ts +392 -392
  82. package/src/core/constants.ts +101 -101
  83. package/src/core/errors.ts +202 -202
  84. package/src/core/hypernum.ts +240 -240
  85. package/src/core/index.ts +4 -4
  86. package/src/index.ts +179 -182
  87. package/src/operations/arithmetic.ts +332 -332
  88. package/src/operations/bitwise.ts +366 -366
  89. package/src/operations/comparison.ts +271 -271
  90. package/src/operations/conversion.ts +399 -399
  91. package/src/operations/factorial.ts +278 -278
  92. package/src/operations/index.ts +4 -4
  93. package/src/operations/power.ts +315 -315
  94. package/src/storage/Heap.ts +237 -237
  95. package/src/storage/index.ts +0 -0
  96. package/src/structures/ackermann.ts +232 -232
  97. package/src/structures/big-array.ts +305 -305
  98. package/src/structures/index.ts +3 -3
  99. package/src/structures/number-tree.ts +403 -403
  100. package/src/structures/power-tower.ts +277 -277
  101. package/src/types/common.d.ts +356 -356
  102. package/src/types/core.d.ts +160 -160
  103. package/src/types/index.d.ts +1 -1
  104. package/src/utils/formatting.ts +245 -245
  105. package/src/utils/index.ts +4 -4
  106. package/src/utils/parser.ts +244 -244
  107. package/src/utils/precision.ts +216 -216
  108. package/src/utils/validation.ts +182 -182
  109. package/tsconfig.json +83 -83
  110. package/dist/types/config/config-loader.d.ts.map +0 -1
  111. package/dist/types/config/config-parser.d.ts.map +0 -1
  112. package/dist/types/config/config-resolver.d.ts.map +0 -1
  113. package/dist/types/config/config-source.d.ts.map +0 -1
  114. package/dist/types/config/index.d.ts.map +0 -1
  115. package/dist/types/core/common.d.ts.map +0 -1
  116. package/dist/types/core/config.d.ts.map +0 -1
  117. package/dist/types/core/constants.d.ts.map +0 -1
  118. package/dist/types/core/errors.d.ts.map +0 -1
  119. package/dist/types/core/hypernum.d.ts.map +0 -1
  120. package/dist/types/core/index.d.ts.map +0 -1
  121. package/dist/types/index.d.ts.map +0 -1
  122. package/dist/types/operations/arithmetic.d.ts.map +0 -1
  123. package/dist/types/operations/bitwise.d.ts.map +0 -1
  124. package/dist/types/operations/comparison.d.ts.map +0 -1
  125. package/dist/types/operations/conversion.d.ts.map +0 -1
  126. package/dist/types/operations/factorial.d.ts.map +0 -1
  127. package/dist/types/operations/index.d.ts.map +0 -1
  128. package/dist/types/operations/power.d.ts.map +0 -1
  129. package/dist/types/storage/Heap.d.ts.map +0 -1
  130. package/dist/types/storage/index.d.ts.map +0 -1
  131. package/dist/types/structures/ackermann.d.ts.map +0 -1
  132. package/dist/types/structures/big-array.d.ts.map +0 -1
  133. package/dist/types/structures/index.d.ts.map +0 -1
  134. package/dist/types/structures/number-tree.d.ts.map +0 -1
  135. package/dist/types/structures/power-tower.d.ts.map +0 -1
  136. package/dist/types/utils/formatting.d.ts.map +0 -1
  137. package/dist/types/utils/index.d.ts.map +0 -1
  138. package/dist/types/utils/parser.d.ts.map +0 -1
  139. package/dist/types/utils/precision.d.ts.map +0 -1
  140. package/dist/types/utils/validation.d.ts.map +0 -1
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 obnexusmk2
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 obnexusmk2
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,256 +1,355 @@
1
- # @obinexuscomputing/hypernum - Computing from the Heart
2
-
3
- ![Logo ](./favicon.svg)
4
-
5
- A comprehensive TypeScript/JavaScript library for handling large number operations with BigInt support.
6
-
7
- ## Features
8
-
9
- - High-precision arithmetic operations
10
- - Bitwise operations
11
- - Special mathematical functions (factorial, GCD, LCM, etc.)
12
- - Advanced data structures for large number manipulation
13
- - Configurable precision and overflow handling
14
- - Type-safe implementation in TypeScript
15
-
16
- ## Installation
17
-
18
- ```bash
19
- npm install @obinexuscomputing/hypernum
20
- ```
21
-
22
- ## Basic Usage
23
-
24
- ```typescript
25
- import { createHypernum } from '@obinexuscomputing/hypernum';
26
-
27
- // Create a Hypernum instance with default configuration
28
- const hypernum = createHypernum();
29
-
30
- // Basic arithmetic operations
31
- const sum = hypernum.add("12345678901234567890", "98765432109876543210");
32
- const product = hypernum.multiply(2n, "1000000000000000000");
33
- ```
34
-
35
- ## Configuration
36
-
37
- You can configure Hypernum with various options:
38
-
39
- ```typescript
40
- const customHypernum = createHypernum({
41
- precision: 10, // Decimal precision
42
- roundingMode: 'HALF_EVEN', // Rounding strategy
43
- checkOverflow: true, // Enable overflow checking
44
- maxSteps: 1000 // Maximum computation steps
45
- });
46
- ```
47
-
48
- ## Core Operations
49
-
50
- ### Arithmetic
51
-
52
- ```typescript
53
- const hypernum = createHypernum();
54
-
55
- // Addition
56
- const sum = hypernum.add(a, b);
57
-
58
- // Subtraction
59
- const difference = hypernum.subtract(a, b);
60
-
61
- // Multiplication
62
- const product = hypernum.multiply(a, b);
63
-
64
- // Division
65
- const quotient = hypernum.divide(a, b);
66
-
67
- // Modulo
68
- const remainder = hypernum.mod(a, b);
69
- ```
70
-
71
- ### Bitwise Operations
72
-
73
- ```typescript
74
- // Bitwise AND
75
- const andResult = hypernum.and(x, y);
76
-
77
- // Bitwise OR
78
- const orResult = hypernum.or(x, y);
79
-
80
- // Bitwise XOR
81
- const xorResult = hypernum.xor(x, y);
82
-
83
- // Bitwise NOT
84
- const notResult = hypernum.not(x);
85
- ```
86
-
87
- ### Power Operations
88
-
89
- ```typescript
90
- // Power
91
- const powered = hypernum.power(base, exponent);
92
-
93
- // Square root
94
- const sqrt = hypernum.sqrt(value);
95
-
96
- // Nth root
97
- const root = hypernum.nthRoot(value, n);
98
- ```
99
-
100
- ## Advanced Features
101
-
102
- ### Data Structures
103
-
104
- #### BigArray
105
-
106
- A specialized array implementation for handling large numbers efficiently:
107
-
108
- ```typescript
109
- import { BigArray } from '@obinexuscomputing/hypernum';
110
-
111
- const array = new BigArray<bigint>();
112
- array.push(12345678901234567890n);
113
- array.push(98765432109876543210n);
114
-
115
- // Range queries
116
- const max = array.queryRange(0, 1);
117
- ```
118
-
119
- #### NumberTree
120
-
121
- An AVL tree implementation optimized for large number operations:
122
-
123
- ```typescript
124
- import { NumberTree } from '@obinexuscomputing/hypernum';
125
-
126
- const tree = new NumberTree();
127
- tree.insert(12345678901234567890n);
128
- tree.insert(98765432109876543210n);
129
-
130
- // Tree operations
131
- const found = tree.find(12345678901234567890n);
132
- const values = tree.traverse('inOrder');
133
- ```
134
-
135
- #### PowerTower
136
-
137
- Handles power tower (tetration) computations:
138
-
139
- ```typescript
140
- import { PowerTower } from '@obinexuscomputing/hypernum';
141
-
142
- const tower = new PowerTower();
143
- tower.build(2n, 4); // Computes 2↑↑4
144
- const result = tower.evaluate();
145
- ```
146
-
147
- #### AckermannStructure
148
-
149
- Computes and manages Ackermann function values:
150
-
151
- ```typescript
152
- import { AckermannStructure } from '@obinexuscomputing/hypernum';
153
-
154
- const ackermann = new AckermannStructure();
155
- const result = ackermann.computeAckermann(3, 2);
156
- ```
157
-
158
- ### Special Functions
159
-
160
- ```typescript
161
- // Greatest Common Divisor
162
- const gcd = hypernum.gcd(48n, 18n);
163
-
164
- // Least Common Multiple
165
- const lcm = hypernum.lcm(48n, 18n);
166
-
167
- // Factorial
168
- import { factorial } from '@obinexuscomputing/hypernum';
169
- const fact = factorial(10n);
170
-
171
- // Binomial coefficient
172
- import { binomial } from '@obinexuscomputing/hypernum';
173
- const combination = binomial(10n, 5n);
174
- ```
175
-
176
- ### Number Format Conversions
177
-
178
- ```typescript
179
- import {
180
- toBinary,
181
- toHexadecimal,
182
- toRoman,
183
- fromRoman
184
- } from '@obinexuscomputing/hypernum';
185
-
186
- // Convert to different bases
187
- const binary = toBinary(123456789n);
188
- const hex = toHexadecimal(123456789n);
189
-
190
- // Roman numeral conversion
191
- const roman = toRoman(3549);
192
- const number = fromRoman("MMMDXLIX");
193
- ```
194
-
195
- ## Error Handling
196
-
197
- The library provides specific error types for different scenarios:
198
-
199
- ```typescript
200
- import {
201
- HypernumError,
202
- OverflowError,
203
- ValidationError
204
- } from '@obinexuscomputing/hypernum';
205
-
206
- try {
207
- const result = hypernum.power(2n, 1000n);
208
- } catch (error) {
209
- if (error instanceof OverflowError) {
210
- console.error('Computation would overflow');
211
- } else if (error instanceof ValidationError) {
212
- console.error('Invalid input values');
213
- }
214
- }
215
- ```
216
-
217
- ## Performance Considerations
218
-
219
- - Use BigInt literals (with 'n' suffix) for direct number input
220
- - Enable overflow checking only when necessary
221
- - Configure precision based on actual requirements
222
- - Use appropriate data structures for your use case
223
- - Consider using the built-in caching mechanisms for repeated computations
224
-
225
- ## Type Safety
226
-
227
- The library is written in TypeScript and provides full type definitions:
228
-
229
- ```typescript
230
- import type {
231
- HypernumConfig,
232
- NumericInput,
233
- OperationOptions
234
- } from '@obinexuscomputing/hypernum';
235
-
236
- // Type-safe configuration
237
- const config: HypernumConfig = {
238
- precision: 10,
239
- checkOverflow: true
240
- };
241
-
242
- // Type-safe numeric input
243
- const input: NumericInput = "12345678901234567890";
244
- ```
245
-
246
- ## Environment Support
247
-
248
- - Node.js 16.0.0
249
- - Modern browsers with BigInt support
250
- - TypeScript ≥ 4.5.0
251
-
252
- ## License
253
-
254
- ISC License
255
-
256
- For more information, visit the [GitHub repository](https://github.com/obinexuscomputing/hypernum).
1
+ # @obinexusmk2/hypernum - Computing from the Heart
2
+
3
+ ![Logo](./docs/favicon.png)
4
+
5
+ A comprehensive TypeScript/JavaScript library for handling large number operations with BigInt support.
6
+
7
+ ## Features
8
+
9
+ - High-precision arithmetic operations
10
+ - Bitwise operations
11
+ - Special mathematical functions (factorial, GCD, LCM, etc.)
12
+ - Advanced data structures for large number manipulation
13
+ - Configurable precision and overflow handling
14
+ - Type-safe implementation in TypeScript
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ # Library dependency
20
+ npm i @obinexusmk2/hypernum
21
+
22
+ # CLI — run without installing
23
+ npx @obinexusmk2/hypernum --help
24
+
25
+ # CLI install globally
26
+ npm i -g @obinexusmk2/hypernum
27
+ hypernum --help
28
+ ```
29
+
30
+ ## CLI Usage
31
+
32
+ Run math operations directly from the terminal without writing code:
33
+
34
+ ```bash
35
+ npx @obinexusmk2/hypernum <command> [args...] [options]
36
+ ```
37
+
38
+ ### Arithmetic
39
+
40
+ | Command | Args | Description |
41
+ |---------|------|-------------|
42
+ | `add` | `<a> <b>` | Add two numbers |
43
+ | `subtract` | `<a> <b>` | Subtract b from a |
44
+ | `multiply` | `<a> <b>` | Multiply two numbers |
45
+ | `divide` | `<a> <b>` | Divide a by b |
46
+ | `mod` | `<a> <b>` | Remainder of a / b |
47
+ | `gcd` | `<a> <b>` | Greatest common divisor |
48
+ | `lcm` | `<a> <b>` | Least common multiple |
49
+ | `abs` | `<n>` | Absolute value |
50
+ | `sign` | `<n>` | Sign (-1, 0, or 1) |
51
+
52
+ ### Power
53
+
54
+ | Command | Args | Description |
55
+ |---------|------|-------------|
56
+ | `power` | `<base> <exp>` | Exponentiation |
57
+ | `sqrt` | `<n>` | Integer square root |
58
+ | `nthRoot` | `<n> <k>` | k-th root of n |
59
+
60
+ ### Factorial
61
+
62
+ | Command | Args | Description |
63
+ |---------|------|-------------|
64
+ | `factorial` | `<n>` | Factorial (n!) |
65
+ | `binomial` | `<n> <k>` | Binomial coefficient C(n,k) |
66
+ | `primorial` | `<n>` | Primorial (n#) |
67
+
68
+ ### Conversion
69
+
70
+ | Command | Args | Description |
71
+ |---------|------|-------------|
72
+ | `toBinary` | `<n>` | Convert to binary |
73
+ | `toOctal` | `<n>` | Convert to octal |
74
+ | `toHex` | `<n>` | Convert to hexadecimal |
75
+ | `toRoman` | `<n>` | Convert to Roman numeral |
76
+ | `fromRoman` | `<str>` | Convert from Roman numeral |
77
+ | `toScientific` | `<n>` | Convert to scientific notation |
78
+ | `toBase` | `<n> <base>` | Convert to arbitrary base |
79
+
80
+ ### Comparison
81
+
82
+ | Command | Args | Description |
83
+ |---------|------|-------------|
84
+ | `compare` | `<a> <b>` | Compare (-1, 0, 1) |
85
+ | `equals` | `<a> <b>` | Test equality (true/false) |
86
+ | `lessThan` | `<a> <b>` | Test a < b (true/false) |
87
+ | `greaterThan` | `<a> <b>` | Test a > b (true/false) |
88
+
89
+ ### Config
90
+
91
+ ```bash
92
+ npx @obinexusmk2/hypernum --init # Create hypernum.config.json
93
+ npx @obinexusmk2/hypernum --config # Show resolved config
94
+ ```
95
+
96
+ ### Options
97
+
98
+ | Flag | Description |
99
+ |------|-------------|
100
+ | `--precision <n>` | Set decimal precision |
101
+ | `--no-overflow` | Disable overflow checking |
102
+ | `--version`, `-v` | Show version |
103
+ | `--help`, `-h` | Show help |
104
+
105
+ ### Examples
106
+
107
+ ```bash
108
+ npx @obinexusmk2/hypernum add 123456789012345678901234567890 987654321098765432109876543210
109
+ npx @obinexusmk2/hypernum factorial 100
110
+ npx @obinexusmk2/hypernum toRoman 2024
111
+ npx @obinexusmk2/hypernum toBase 255 16
112
+ npx @obinexusmk2/hypernum sqrt 144
113
+ ```
114
+
115
+ ### Windows Note
116
+
117
+ `npm link` requires **Developer Mode** on Windows (Settings → Privacy & Security → For Developers → Developer Mode: On).
118
+
119
+ Without Developer Mode, use `npm install -g @obinexusmk2/hypernum` instead.
120
+
121
+ ## Basic Usage
122
+
123
+ ```typescript
124
+ import { createHypernum } from '@obinexusmk2/hypernum';
125
+
126
+ // Create a Hypernum instance with default configuration
127
+ const hypernum = createHypernum();
128
+
129
+ // Basic arithmetic operations
130
+ const sum = hypernum.add("12345678901234567890", "98765432109876543210");
131
+ const product = hypernum.multiply(2n, "1000000000000000000");
132
+ ```
133
+
134
+ ## Configuration
135
+
136
+ You can configure Hypernum with various options:
137
+
138
+ ```typescript
139
+ const customHypernum = createHypernum({
140
+ precision: 10, // Decimal precision
141
+ roundingMode: 'HALF_EVEN', // Rounding strategy
142
+ checkOverflow: true, // Enable overflow checking
143
+ maxSteps: 1000 // Maximum computation steps
144
+ });
145
+ ```
146
+
147
+ ## Core Operations
148
+
149
+ ### Arithmetic
150
+
151
+ ```typescript
152
+ const hypernum = createHypernum();
153
+
154
+ // Addition
155
+ const sum = hypernum.add(a, b);
156
+
157
+ // Subtraction
158
+ const difference = hypernum.subtract(a, b);
159
+
160
+ // Multiplication
161
+ const product = hypernum.multiply(a, b);
162
+
163
+ // Division
164
+ const quotient = hypernum.divide(a, b);
165
+
166
+ // Modulo
167
+ const remainder = hypernum.mod(a, b);
168
+ ```
169
+
170
+ ### Bitwise Operations
171
+
172
+ ```typescript
173
+ // Bitwise AND
174
+ const andResult = hypernum.and(x, y);
175
+
176
+ // Bitwise OR
177
+ const orResult = hypernum.or(x, y);
178
+
179
+ // Bitwise XOR
180
+ const xorResult = hypernum.xor(x, y);
181
+
182
+ // Bitwise NOT
183
+ const notResult = hypernum.not(x);
184
+ ```
185
+
186
+ ### Power Operations
187
+
188
+ ```typescript
189
+ // Power
190
+ const powered = hypernum.power(base, exponent);
191
+
192
+ // Square root
193
+ const sqrt = hypernum.sqrt(value);
194
+
195
+ // Nth root
196
+ const root = hypernum.nthRoot(value, n);
197
+ ```
198
+
199
+ ## Advanced Features
200
+
201
+ ### Data Structures
202
+
203
+ #### BigArray
204
+
205
+ A specialized array implementation for handling large numbers efficiently:
206
+
207
+ ```typescript
208
+ import { BigArray } from '@obinexusmk2/hypernum';
209
+
210
+ const array = new BigArray<bigint>();
211
+ array.push(12345678901234567890n);
212
+ array.push(98765432109876543210n);
213
+
214
+ // Range queries
215
+ const max = array.queryRange(0, 1);
216
+ ```
217
+
218
+ #### NumberTree
219
+
220
+ An AVL tree implementation optimized for large number operations:
221
+
222
+ ```typescript
223
+ import { NumberTree } from '@obinexusmk2/hypernum';
224
+
225
+ const tree = new NumberTree();
226
+ tree.insert(12345678901234567890n);
227
+ tree.insert(98765432109876543210n);
228
+
229
+ // Tree operations
230
+ const found = tree.find(12345678901234567890n);
231
+ const values = tree.traverse('inOrder');
232
+ ```
233
+
234
+ #### PowerTower
235
+
236
+ Handles power tower (tetration) computations:
237
+
238
+ ```typescript
239
+ import { PowerTower } from '@obinexusmk2/hypernum';
240
+
241
+ const tower = new PowerTower();
242
+ tower.build(2n, 4); // Computes 2↑↑4
243
+ const result = tower.evaluate();
244
+ ```
245
+
246
+ #### AckermannStructure
247
+
248
+ Computes and manages Ackermann function values:
249
+
250
+ ```typescript
251
+ import { AckermannStructure } from '@obinexusmk2/hypernum';
252
+
253
+ const ackermann = new AckermannStructure();
254
+ const result = ackermann.computeAckermann(3, 2);
255
+ ```
256
+
257
+ ### Special Functions
258
+
259
+ ```typescript
260
+ // Greatest Common Divisor
261
+ const gcd = hypernum.gcd(48n, 18n);
262
+
263
+ // Least Common Multiple
264
+ const lcm = hypernum.lcm(48n, 18n);
265
+
266
+ // Factorial
267
+ import { factorial } from '@obinexusmk2/hypernum';
268
+ const fact = factorial(10n);
269
+
270
+ // Binomial coefficient
271
+ import { binomial } from '@obinexusmk2/hypernum';
272
+ const combination = binomial(10n, 5n);
273
+ ```
274
+
275
+ ### Number Format Conversions
276
+
277
+ ```typescript
278
+ import {
279
+ toBinary,
280
+ toHexadecimal,
281
+ toRoman,
282
+ fromRoman
283
+ } from '@obinexusmk2/hypernum';
284
+
285
+ // Convert to different bases
286
+ const binary = toBinary(123456789n);
287
+ const hex = toHexadecimal(123456789n);
288
+
289
+ // Roman numeral conversion
290
+ const roman = toRoman(3549);
291
+ const number = fromRoman("MMMDXLIX");
292
+ ```
293
+
294
+ ## Error Handling
295
+
296
+ The library provides specific error types for different scenarios:
297
+
298
+ ```typescript
299
+ import {
300
+ HypernumError,
301
+ OverflowError,
302
+ ValidationError
303
+ } from '@obinexusmk2/hypernum';
304
+
305
+ try {
306
+ const result = hypernum.power(2n, 1000n);
307
+ } catch (error) {
308
+ if (error instanceof OverflowError) {
309
+ console.error('Computation would overflow');
310
+ } else if (error instanceof ValidationError) {
311
+ console.error('Invalid input values');
312
+ }
313
+ }
314
+ ```
315
+
316
+ ## Performance Considerations
317
+
318
+ - Use BigInt literals (with 'n' suffix) for direct number input
319
+ - Enable overflow checking only when necessary
320
+ - Configure precision based on actual requirements
321
+ - Use appropriate data structures for your use case
322
+ - Consider using the built-in caching mechanisms for repeated computations
323
+
324
+ ## Type Safety
325
+
326
+ The library is written in TypeScript and provides full type definitions:
327
+
328
+ ```typescript
329
+ import type {
330
+ HypernumConfig,
331
+ NumericInput,
332
+ OperationOptions
333
+ } from '@obinexusmk2/hypernum';
334
+
335
+ // Type-safe configuration
336
+ const config: HypernumConfig = {
337
+ precision: 10,
338
+ checkOverflow: true
339
+ };
340
+
341
+ // Type-safe numeric input
342
+ const input: NumericInput = "12345678901234567890";
343
+ ```
344
+
345
+ ## Environment Support
346
+
347
+ - Node.js ≥ 16.0.0
348
+ - Modern browsers with BigInt support
349
+ - TypeScript ≥ 4.5.0
350
+
351
+ ## License
352
+
353
+ ISC License
354
+
355
+ For more information, visit the [GitHub repository](https://github.com/obinexusmk2/hypernum).