metanum 2.1.2 → 2.2.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![NPM](https://img.shields.io/npm/v/metanum.svg)](https://www.npmjs.com/package/metanum)
4
4
 
5
- - MetaNum v2.1.2 by dlsdl
5
+ - MetaNum v2.2.0 by dlsdl
6
6
 
7
7
  A huge number library holding up to X↑↑X&9e15.
8
8
 
@@ -42,6 +42,8 @@ const h = MetaNum.fromString("[[10], [1, 3]]"); // bracket notation
42
42
  // From an array
43
43
  const i = MetaNum.fromArray([2.71828, 1, 2]); // array=[[2.71828, 1, 2]], =10^^10^^10^2.71828
44
44
  const j = MetaNum.fromArray([10], 1, 1); // layer 1
45
+ const normalized = MetaNum.fromArray([1e10, 520.73, 1]);
46
+ // Construction normalizes coefficients: normalized.array=[[10000000000,520,1]]; the numeric value is preserved.
45
47
 
46
48
  // From an object / JSON
47
49
  const k = MetaNum.fromJSON('{"sign":1,"array":[[428571]],"layer":0}');
@@ -58,12 +60,12 @@ const n = MetaNum.fromHyperE("EE100");
58
60
 
59
61
  ```javascript
60
62
  MetaNum.MAX_SAFE_INTEGER // 9007199254740991
61
- MetaNum.E // log10(MSI)=15.954589770191
63
+ MetaNum.MAX_E // log10(MSI)=15.954589770191
62
64
  MetaNum.POSITIVE_INFINITY // Infinity
63
65
  MetaNum.NEGATIVE_INFINITY // -Infinity
64
66
  MetaNum.GRAHAMS_NUMBER // Graham's number (approximation)
65
67
  MetaNum.TRITRI // 3↑↑↑3 = 3^^^3
66
- MetaNum.QqQe308 // QqQe308 (for incremental games)
68
+ MetaNum.QqQe308 // QqQe308 = 10{ω17+16}10{ω17+4}308 (for incremental games)
67
69
  ```
68
70
 
69
71
  ## Basic Usage
@@ -151,8 +153,8 @@ MetaNum.arrow(3, 4, 3); // 3↑↑↑↑3 = g_1
151
153
  // Chain notation
152
154
  new MetaNum(2).chain(4, 3); // 2→4→3
153
155
 
154
- // Aperiation: a↑^a a
155
- new MetaNum(2).aper(3); // 2↑↑↑2 = 4
156
+ // Aperiation: x.aper(y) = x{y}y
157
+ new MetaNum(2).aper(3); // 2{3}3 = 65536
156
158
  ```
157
159
 
158
160
  ## Super-logarithm & Super-root
@@ -160,7 +162,8 @@ new MetaNum(2).aper(3); // 2↑↑↑2 = 4
160
162
  ```javascript
161
163
  // Super-logarithm (inverse of tetration)
162
164
  new MetaNum(16).slog(2); // slog_2(16) = 3
163
- new MetaNum(65536).slog(); // slog_10(65536) ≈ 2
165
+ new MetaNum(65536).slog(); // slog_10(65536) ≈ 1.834 — the closed-form approximation,
166
+ // NOT the principal-branch real inverse (hyper_log(65536,10,2) = 1.6827…)
164
167
 
165
168
  // Super-square-root
166
169
  new MetaNum(27).ssrt(); // ssqrt(27)
@@ -172,12 +175,19 @@ new MetaNum(100).linear_sroot(3); // ³ss̅r̅t̅(100)
172
175
  new MetaNum(10).layeradd(3); // add 3 layers of exponentiation
173
176
  new MetaNum(10).layeradd10(3); // 10^^3 (explicit base 10)
174
177
 
175
- // General hyperoperation inverses: if a{b}c = d then d.hyper_log(a)(b) = c and d.hyper_root(c)(b) = a
178
+ // General hyperoperation inverses: if a{α}c = d then d.hyper_log(a)(α) = c and d.hyper_root(c)(α) = a
179
+ // (real-valued: non-integer heights/bases come back as non-integers; see "Continuous real-valued inverses")
176
180
  MetaNum(14).hyper_log(2)(0); // 2*7 = 14 → 7
177
181
  MetaNum(100000).hyper_log(10)(1); // 10^5 → 5
178
182
  MetaNum(65536).hyper_log(2)(2); // 2↑↑4 → 4 (slog)
179
183
  MetaNum(65536).hyper_root(4)(2); // 2↑↑4 → 2 (base recovery)
180
184
  MetaNum(10).arrow(3)(3).hyper_root(3)(3); // 10↑↑↑3 → 10
185
+ MetaNum(7).hyper_log(2)(0); // 3.5 — a real answer, not 3 or 4
186
+ MetaNum(3).hyper_log(2)(1); // 1.5849625… = log₂(3)
187
+ MetaNum(2).hyper_root(2)(1); // 1.4142135… = √2
188
+ MetaNum(2).tetr(2.5).hyper_log(2)(2); // 2.5 — the real height
189
+ MetaNum(2).tetr(2.5).hyper_log(2)(2, { diagnostics: true });
190
+ // InverseResult { status: "approximate", value: 2.4999…, residual: …, … }
181
191
  ```
182
192
 
183
193
  ## Hyper-Operations up to ε₀
@@ -271,6 +281,9 @@ x.iterate(3); // iter(3) = hww
271
281
  // Level ω^ω+1: iterate ω^ω level operations
272
282
  x.itermult(3); // itmu(3) = hw01
273
283
 
284
+ // Level ω^ω+ω: diagonalize ω^ω+y
285
+ x.iteraperiate(3); // itap(3) = hw0w
286
+
274
287
  // Level ω^ω*2: (ω^ω)*2 = ω^ω + ω^base
275
288
  x.cuboiter(3); // cube(3) = hwx2
276
289
 
@@ -321,8 +334,9 @@ x.i_epan(z) // i1010 = inverse of expandainate
321
334
  x.i_mgan(z) // i1100 = inverse of megodainate
322
335
  x.i_pwar(z) // i2000 = inverse of powiairate
323
336
  x.i_apgu(z) // i10000 = inverse of aperioguate
324
- x.i_iter(z) // iww = inverse of iter
337
+ x.i_iter(z) // iww = inverse of iter
325
338
  x.i_itmu(z) // iw01 = inverse of itermult
339
+ x.i_itap(z) // iw0w = inverse of iteraperiate
326
340
  x.i_cube(z) // iwx2 = inverse of cuboiter
327
341
  x.i_expo(z) // iwa1 = inverse of expoiter
328
342
  x.i_tria(z) // iwm2 = inverse of trioterate
@@ -331,26 +345,46 @@ x.i_apix(z) // iwpw = inverse of aperixxate
331
345
  x.i_epsl(z) // iepsl = inverse of epsilonate
332
346
  ```
333
347
 
334
- ### The operations follow n{λ}b = n{λ[b]}n exactly
348
+ ### Root forms: c.{α}root(b) = a
349
+
350
+ Each expansion operation also has a **root-form inverse** recovering the **base** (the log form `x.i_<op>(a)` above recovers the height `b`; the root form takes the height and recovers the base): if `a{α}b = c` then `c.<op>_root(b) = a`, e.g. `(10{ω}15).aperiote_root(15) = 10` just like `(10{ω}15).i_aper(10) = 15`.
351
+
352
+ The base map `a ↦ a{α}b` is monotone on the declared principal branch, so the base is recovered by the **continuous real-valued solver** described below — the same dispatcher `hyper_log`/`hyper_root` use at the finite levels. Beyond the representation budget the stored value no longer encodes the base (huge-argument markers; base-independent layer markers at the ω^ω+ levels), and the root returns the **smallest base reproducing the stored value** on the declared branch (`minimal-reproducing`, see below).
353
+
354
+ Every root form also exists under its short alias (`x.r_aper(z)`, `x.r_expa(z)`, …), as a static (`MetaNum.aperiote_root(value, height)`), and under the equivalent `root_<op>` name (`x.root_aperiote(z)`, `MetaNum.root_aperiote(value, height)`). `root_<op>` is an added alias — `<op>_root` and `r*` keep their names and semantics.
355
+
356
+ ### Continuous real-valued inverses: definitions, API, algorithm, results and limits
335
357
 
336
- Every operation above is evaluated with the unified limit rule `n{λ}b = n{λ[b]}n` — the final operand is the **base** n, never b. Whenever the reduced level λ[y] still fits a Cantor-normal-form coefficient row the whole fundamental-sequence cascade is evaluated:
358
+ Both inverse families solve one equation with one unknown. The forward function is never redefined for the inverse:
359
+
360
+ ```
361
+ F(n, α, b) = n{α}b (rules 1–4, the unified limit rule n{λ}b = n{λ[b]}b,
362
+ successor interpolation x{α}(m+f) = x{α-1} applied m times to x^f,
363
+ fractional coefficients and fractional levels — all unchanged)
364
+
365
+ log form: fix n and α, solve F(n, α, b) = c for the real height b
366
+ root form: fix α and b, solve F(n, α, b) = c for the real base n
367
+ ```
368
+
369
+ ### The operations follow n{λ}b = n{λ[b]}b exactly
370
+
371
+ To keep the continuity, every operation above is evaluated with the unified limit rule `n{λ}b = n{λ[b]}b` — the final operand is **b**. Only take the fundamental sequence and not change any number. Whenever the reduced level λ[y] still fits a Cantor-normal-form coefficient row the whole fundamental-sequence cascade is evaluated:
337
372
 
338
373
  ```javascript
339
- MetaNum(3).iterate(5); // 3{ω^ω}5 = 3{ω^5}3 = 3{ω^4*3}3 = …
340
- // … = 3{ω^4*2+ω^3*2+ω^2*2+ω*2+2}3 → layer=0, top row [1,2,2,2,2,2]
374
+ MetaNum(3).iterate(5); // 3{ω^ω}5 = 3{ω^5}5 = 3{ω^4*5}5 = … = 3{ω^4*4+ω^3*4+ω^2*4+ω*4+5}5 = (3{ω^4*4+ω^3*4+ω^2*4+ω*4+4})^3… → layer=0, top row [3,4,4,4,4,4]
341
375
  ```
342
376
 
343
377
  Levels ≥ ω^ω have no finite coefficient row, so the result is stored as the compact **layer marker** of λ[y] (see the representation rule above: layer L ⇒ `10{ω^ω^…(L ω^'s)…^(ω^'s polynomial)}10`):
344
378
 
345
- so the encoded ordinals grow with the operation (`iter < itmu < cube < expo < tria < trix < apix < epsl`) and with y, and `epsilonate(MSI)` is exactly the library's ε-tower cap.
379
+ so the encoded ordinals grow with the operation (`iter < itmu < cube < expo < tria < trix < apix < epsl`) and with y, and `epsilonate(MSI)` is exactly the library's ε-tower cap. Results > epsilonate(MSI) will return Infinity.
346
380
 
347
381
  ### Fractional hyperoperation levels
348
382
 
349
- Levels interpolate geometrically; `x{n+f}y = x{n+1}(θf)` with `θf` continuous between `x{n}y` (f=0) and `x{n+1}y` (f=1). For the canonical diagonal this is exactly `10{n+f}10 = 10{n+1}(2·5^f)`:
383
+ Levels interpolate geometrically; `x{n+f}y = x{n+1}(θf)` with `θf` continuous between `x{n}y` (f=0) and `x{n+1}y` (f=1). For the canonical diagonal this is exactly `10{n+f}10 = 10{n+1}(2·5^f)`, monotone between 10{3}10 and 10{4}10:
350
384
 
351
385
  ```javascript
352
386
  MetaNum(10).arrow(3.5)(10); // 10{3.5}10 = 10{4}(2·5^0.5)
353
- MetaNum(10).arrow(3.2)(10); // monotone between 10{3}10 and 10{4}10
387
+ MetaNum(10).arrow(3.2)(10); // 10{3.2}10 = 10{4}(2·5^0.2)
354
388
  ```
355
389
 
356
390
  ### Non-integer arguments at ordinal levels
@@ -363,32 +397,32 @@ MetaNum(10).expande(2); // 10{ω}10 (continuous at the integers)
363
397
  MetaNum(10).multiexpande(2.1); // (10{ω+1})²(10^0.1)
364
398
  ```
365
399
 
366
- **Limit levels** take the fundamental sequence at the full (fractional) `y`. The sequence can then carry fractional coefficients, which resolve against the base x because on the diagonal ω reads as x:
400
+ **Limit levels** take the fundamental sequence at the full (fractional) `y`. The sequence can then carry fractional coefficients, which resolve against the operand y — the same number that indexes the fundamental sequence:
367
401
 
368
- - ω^(k)·(c+f) = ω^(k)·c + ω^(k-1)·(x·f), applied top-down (ω^0.1 = x^0.1), so only the constant term can still be fractional;
369
- - a leftover fractional constant γ+f is one level of interpolation: x{γ+f}x = x{γ+1}(2·(x/2)^f) — continuous at f=0 because x{γ+1}2 = x{γ}x.
402
+ - ω^(k)·(c+f) = ω^(k)·c + ω^(k-1)·(y·f), applied top-down (ω^0.1 = y^0.1), so only the constant term can still be fractional;
403
+ - a leftover fractional constant γ+f is one level of interpolation: x{γ+f}y = x{γ+1}(2·(y/2)^f) — continuous at f=0 because x{γ+1}2 = x{γ}x, and monotone across the integer grid while y ≤ x (for y > x the value stays inside the interpolation band [x{γ+1}2, x{γ+1}y)).
370
404
 
371
405
  **Successor levels** keep `x{α}(m+f) = x{α-1}` applied m times to `x^f`, so the value grows with f inside the interval and converges to the next integer as f → 1:
372
406
 
373
407
  ```javascript
374
- MetaNum(10).h21(2.0001); // Ba2.218Ab9 f → 0: cascade bottoming at ω
375
- MetaNum(10).h21(2.5); // Ba1.772Ad9 the cascade deepens with f
376
- MetaNum(10).h21(2.99); // Ba2.447Aj9 → converges to h21(10,3) = Ba1.000Ak9
408
+ MetaNum(10).h21(2.01); // 10{ω2+1}2.01=10{ω2}10{ω2}10^0.01(=1.023293)=10{ω2}10{ω+1.023293}1.023293=10{ω2}10{ω+1}(2^0.023293)^0.976707*(10^0.023293)^0.023293
409
+ MetaNum(10).h21(2.5); // 10{ω2+1}2.5
410
+ MetaNum(10).h21(2.99); // 10{ω2+1}2.99
377
411
  ```
378
412
 
379
413
  For the ω+1 / ω+2 / ω+3 levels the applications after the first still have an operand inside MSI, so those are evaluated directly by the rule (that is the `10{ω}10{ω}(10^0.1)` composition above) — which is also the exact identity. An iteration count beyond direct evaluation diagonalizes through the engine's huge-argument convention (y plus one α-level marker row). Then we have:
380
414
 
381
- 10{ω\*2}2.1=10{ω+2.1}10=10{ω+3}2\*5^0.1 (because 10{ω+2}10=10{ω+3}2)
415
+ 10{ω\*2}2.1=10{ω+2.1}2.1=10{ω+3}2\*(2.1/2)^0.1
382
416
 
383
- 3{ω\*2}2.1=3{ω+2.1}3=3{ω+3}2\*1.5^0.1
417
+ 3{ω\*2}2.1=3{ω+2.1}2.1=3{ω+3}2\*(2.1/2)^0.1
384
418
 
385
- 10{ω^2}2.1=10{ω\*2.1}10=10{ω\*2+10\*0.1}10=10{ω\*2+1}10
419
+ 10{ω^2}2.1=10{ω\*2.1}2.1=10{ω\*2+2.1\*0.1}2.1=10{ω\*2+0.21}2.1
386
420
 
387
- 3{ω^2}2.1=3{ω\*2.1}3=3{ω\*2+3\*0.1}10=3{ω\*2+0.3}3=3{ω\*2+1}2\*1.5^0.3
421
+ 3{ω^2}2.1=3{ω\*2.1}2.1=3{ω\*2+2.1\*0.1}2.1=3{ω\*2+0.21}2.1
388
422
 
389
- 10{ω^ω}2.1=10{ω^2.1}10=10{ω^2\*10^0.1}10=10{ω^2\*1.258925}10=10{ω^2\*1+ω\*2+5.8925}10=10{ω^2\*1+ω\*2+6}2*5^0.8925
423
+ 10{ω^ω}2.1=10{ω^2.1}2.1=10{ω^2\*2.1^0.1}2.1=10{ω^2\*1.077}2.1=10{ω^2+0.339638}2.1
390
424
 
391
- 3{ω^ω}2.1=3{ω^2.1}3=3{ω^2\*3^0.1}3=3{ω^2\*1.116123}3=3{ω^2\*1+1.045107}3=3{ω^2\*1+2}2*1.5^0.045107
425
+ 3{ω^ω}2.1=3{ω^2.1}2.1=3{ω^2\*2.1^0.1}2.1=3{ω^2.1\*1.077}2.1=3{ω^2+0.339638}2.1
392
426
 
393
427
  ## BEAF Operations
394
428
 
@@ -402,7 +436,8 @@ MetaNum.BEAF(3, 3, 2); // 3↑↑3 = 7625597484987
402
436
  MetaNum.BEAF(3, 3, 3); // 3↑↑↑3 = tritri
403
437
 
404
438
  // 4-entry: {a,b,c,d} = a(ω*(d-1)+c level operation)b
405
- MetaNum.BEAF(2, 2, 1, 2); // 2{ω}2
439
+ MetaNum.BEAF(2, 2, 1, 2); // 2{ω+1}2 = 4
440
+ MetaNum.BEAF(3, 3, 1, 2); // 3{ω+1}3 (distinguishes the ordinal level from 3{ω}3)
406
441
  MetaNum.BEAF(3, 3, 3, 3); // 3{ω*2+3}3
407
442
 
408
443
  // 5+ entry: ordinal arithmetic
@@ -492,7 +527,7 @@ Fractional inputs collapse into ONE plain row (the fractional hyper-operation re
492
527
 
493
528
  ```javascript
494
529
  MetaNum.hardy(1e10) < MetaNum.hardy("1e10+0.5") < MetaNum.hardy(1e10+1); // single rows throughout
495
- MetaNum.hardy("1e10+0.5"); // [4581.009607833985, 10,10,10,10,10,10,10,10,10]
530
+ MetaNum.hardy("1e10+0.5"); // [4581.009607833985, 8×10] (the base followed by eight 10s)
496
531
  MetaNum.hardy("1e10+1.5"); // [10030.57513899962, 11×10]
497
532
  ```
498
533
 
@@ -563,7 +598,7 @@ new MetaNum(100).valueOf(); // "100"
563
598
  new MetaNum(100).toFixed(2); // "100.00"
564
599
  new MetaNum(100).toExponential(2); // "1.00e+2"
565
600
  new MetaNum(100).toPrecision(3); // "100"
566
- new MetaNum(100).toHyperE(); // "100"
601
+ new MetaNum(100).toHyperE(); // "E2"
567
602
  new MetaNum(100).toStringWithDecimalPlaces(4); // "100.0000"
568
603
  new MetaNum(100).toJSON(); // {sign:1, array:[[100]], layer:0}
569
604
  new MetaNum(100).format(); // letter notation (format-metanum.js), e.g. MetaNum.hardy(4166).format() → "2.397G5", optional args: format(precision, small)
@@ -580,11 +615,11 @@ MetaNum.hyper(4, 2, 3); // 2^^3 = 16 (n=4 means tetration)
580
615
 
581
616
  // Geometric series
582
617
  MetaNum.sumGeometricSeries(5, 1, 2); // 1+2+4+8+16 = 31
583
- MetaNum.affordGeometricSeries(100, 1, 2, 0);
618
+ MetaNum.affordGeometricSeries(100, 1, 2, 0); // 6 (cost 63; the next item would cost 127 in total)
584
619
 
585
620
  // Arithmetic series
586
621
  MetaNum.sumArithmeticSeries(5, 1, 2); // 1+3+5+7+9 = 25
587
- MetaNum.affordArithmeticSeries(100, 1, 2, 0);
622
+ MetaNum.affordArithmeticSeries(100, 1, 2, 0); // 10 (total cost 100)
588
623
 
589
624
  // Configuration
590
625
  MetaNum.config({ maxRows: 50, maxCols: 50, serializeMode: 1, debug: 1 });
@@ -606,7 +641,7 @@ Let n and b be natural numbers, and α be a countable ordinal
606
641
 
607
642
  - rule 1: If α=0, n{α}b=n×b
608
643
  - rule 2: If α is a successor ordinal, then n{α}b =n if b=1, =n{α-1}n{α}(b-1) if b>1
609
- - rule 3: If α is a limit ordinal, then n{α}b=n{α\[b]}n
644
+ - rule 3: If α is a limit ordinal, then n{α}b=n{α\[b]}b
610
645
  - rule 4: Operations are calculated from right to left
611
646
 
612
647
  where α\[b] denotes the b-th element of the fundamental sequence assign to the limit ordinal of α, see also fundamental sequences for limit ordinals written in Cantor normal form:
@@ -619,24 +654,29 @@ where α\[b] denotes the b-th element of the fundamental sequence assign to the
619
654
 
620
655
  ### The application count of each ordinal row
621
656
 
622
- Expanding rules 2-3 all the way down shows that **only the top row depends on the argument b**
623
- — every row below it is produced by decomposing with the base n as the operand:
624
- - successor α: n{α}b = n{α-1}^(b-2) (n{α-1}n), so the α-1 row carries **b-2** applications and every lower row (which comes from n{α-1}n, n{α-2}n, … whose operand is n) carries **n-2**;
625
- - limit α: rule 3 first rewrites n{α}b = n{α\[b]}n, so the operand is n at every level and **all** rows carry **n-2**.
626
- - when expanded ordinal rows >= maxRows, it is truncated, and array[0] is default [10] and the first ordinal row count add 1.(to get precise value)
657
+ Expanding rules 2-3 all the way down requires distinguishing the successor terminal seed from operand preservation at limit steps:
658
+ - successor α: n{α}b = n{α-1}^(b-2) (n{α-1}n), so the α-1 row carries **b-2** applications. The **n-2** count applies only to successor rows reached from the terminal seed n{α-1}n while their current operand is n; a nested successor row with current operand u instead carries **u-2** applications;
659
+ - limit α: rule 3 rewrites n{α}b = n{α\[b]}b, preserving b both as the fundamental-sequence index and as the final operand. A limit step alone therefore does not introduce the base n or an n-2 count. Lower successor rows carry **n-2** only when their current operand is the terminal seed n produced by rule 2;
660
+ - when expanded ordinal rows >= maxRows, it is truncated, and array[0] is default [10] and the first ordinal row count add 1.(to get precise value). Thus maxRows changes the displayed array; it does not change the untruncated mathematical expansion or the operand-derived application counts.
627
661
 
628
662
  ```javascript
629
663
  MetaNum(10).h13(20); // 10{ω+3}20 = 10{ω+2}^18 10{ω+1}^8 10{ω}^8 10{ω}10
630
- // array → [[1e10,8,8,8,8,8,8,8,8], [8,0,1], [8,1,1], [18,2,1]]
664
+ // array → [[1e10,8,8,8,8,8,8,8,8,8], [8,0,1], [8,1,1], [18,2,1]] (nine 8s after 1e10)
631
665
  MetaNum(10).h12(20); // 10{ω+2}20 → [8,0,1] [18,1,1]
632
- MetaNum(3).h13(20); // 3{ω+3}20 → [1,0,1] [1,1,1] [18,2,1] (x-2 = 1)
666
+ MetaNum(3).h13(20); // 3{ω+3}20, including r0
667
+ // array → [[3638334640023.7783,7625597484984], [1,0,1], [1,1,1], [18,2,1]]
633
668
  MetaNum(10).h21(20); // 10{ω*2+1}20 = 10{ω*2}^18 (10{ω*2}10)
634
669
  // 10{ω*2}10 = 10{ω+10}10 → the ω..ω+9 cascade, every count x-2 = 8
635
670
  // array → [[…,8,…], [8,0,1] … [8,9,1], [18,0,2]]
636
671
  MetaNum(10).h22(20); // … + [8,0,2] + [18,1,2] (ω*2 row = 8, ω*2+1 row = 18)
637
672
  MetaNum(3).h21(20); // 3{ω*2+1}20 → [1,0,1] [1,1,1] [1,2,1] [18,0,2] (x-2 = 1)
638
- MetaNum(10).h100(20); //10{ω^2}20=10{ω*20}10=10{ω*19+9}^8 10{ω*19+8}^8 ... 10{ω*18+1}^9 10
639
- // array → [[10], [9,1,18], [8,2,18] … [8,8,19], [8,9,19]] (maxrows=20)
673
+ MetaNum.maxRows = 20;
674
+ MetaNum(10).h100(20); // 10{ω^2}20 = 10{ω*20}20, truncated
675
+ // array → [[10], [9,1,19], [8,2,19], …, [8,18,19], [18,19,19]]
676
+ MetaNum.maxRows = 50;
677
+ MetaNum(10).h100(20); // the same operation without maxRows=20 truncation
678
+ // array → [[10], [9,1,16], [8,2,16], …, [8,18,19], [18,19,19]]
679
+ MetaNum.maxRows = 20;
640
680
  ```
641
681
 
642
682
  ## Examples
@@ -649,21 +689,27 @@ MetaNum(10).h100(20); //10{ω^2}20=10{ω*20}10=10{ω*19+9}^8 10{ω*19+8}^8 ...
649
689
 
650
690
  10{3}3=10{2}10{2}10=10{2} 9(10{1})'s 10=10↑↑(10^10^10^10^10^10^10^10^10000000000)
651
691
 
652
- 3{ω}5=3{5}3=3{4}3{5}2=3{4}3{4}3=3{4}3{3}3{3}3=3{4}3{3}3{2}3{2}3=3{4}3{3}3{2}3{1}3{1}3=3↑↑↑↑3↑↑↑3↑↑7625597484987
692
+ 3{ω}5=3{ω[5]}5=3{5}5=3{4}3{5}4=…=3{4}3{4}3{4}3{4}3=3↑↑↑↑(3↑↑↑↑(3↑↑↑↑(3↑↑↑↑3)))
693
+
694
+ 5{ω+1}4=5{ω}5{ω+1}3=5{ω}5{ω}5{ω+1}2=5{ω}5{ω}5{ω}5{ω+1}1=5{ω}5{ω}5{ω}5
695
+
696
+ Let C=5{ω}5=5{ω[5]}5=5{5}5 and D=5{ω}C=5{ω[C]}C=5{C}C. Then 5{ω+1}4=5{ω}5{ω}C=5{ω}D=5{ω[D]}D=5{D}D.
653
697
 
654
- 5{ω+1}4=5{ω}5{ω+1}3=5{ω}5{ω}5{ω+1}2=5{ω}5{ω}5{ω}5{ω+1}1=5{ω}5{ω}5{ω}5=5{ω}5{ω}5{5}5=5{ω}5{5{5}5}5=5{5{5{5}5}5}5
698
+ 4{ω+2}3=4{ω+1}4{ω+2}2=4{ω+1}4{ω+1}4
655
699
 
656
- 4{ω+2}3=4{ω+1}4{ω+1}4=4{ω+1}4{ω}4{ω}4{ω}4=4{ω+1}4{4{4{4}4}4}4=4{ω}4{ω}... with 4{4{4{4}4}4}4 4's
700
+ Let Q=4{ω}4=4{ω[4]}4=4{4}4, R=4{ω}Q=4{ω[Q]}Q=4{Q}Q, and S=4{ω}R=4{ω[R]}R=4{R}R. Then 4{ω+1}4=4{ω}4{ω}4{ω}4=S, so 4{ω+2}3=4{ω+1}S=4{ω}^(S-2)(4{ω}4)=4{ω}^(S-2)Q.
657
701
 
658
702
  10{ω×2}10=10{ω+10}10=9(10{ω+9})'s 10=8(10{ω+9})'s 9(10{ω+8})'s 10=8(10{ω+9})'s 8(10{ω+8})'s ... 8(10{ω+1})'s 8(10{ω})'s 8(10{9})'s ... 8(10{1})'s 10000000000
659
703
 
660
- 10{ω^2}4=10{(ω^2)[4]}10=10{ω×4}10=10{(ω×4)[10]}10=10{ω×3+10}10=10{ω×3+9}10{ω×3+10}9=...=10{ω×3+9} 8(10{ω×3+8})'s ... 8(10{ω×3+1})'s 8(10{ω×3})'s 8(10{ω×2+9})'s ... 8(10{ω})'s ... 8(10{1})'s 10000000000
704
+ 10{ω^2}4=10{(ω^2)[4]}4=10{ω×4}4=10{(ω×4)[4]}4=10{ω×3+4}4=10{ω×3+3}10{ω×3+3}10{ω×3+3}10=10{ω×3+3}^2(10{ω×3+3}10)
661
705
 
662
- 10{ω^ω}4=10{(ω^ω)[4]}10=10{ω^4}10=10{(ω^4)[10]}10=10{ω^3×10}10=... (every limit step ends on the base 10; successor steps iterate) ... 8(10{1})'s 10000000000
706
+ 10{ω^ω}4=10{(ω^ω)[4]}4=10{ω^4}4=10{(ω^4)[4]}4=10{ω^3×4}4
663
707
 
664
- 10{ω^(ω^2)}4=10{(ω^(ω^2))[4]}10=10{ω^(ω×ω)}10=10{ω^(ω×4)}10=10{ω^(ω×3+10)}10=... (rule 3: each FS step ends on the base 10)
708
+ Every further limit step in this example retains the current operand 4; a terminal operand 10 is introduced only by a subsequent successor step.
665
709
 
666
- 10{ε₀}4=10{ε₀[4]}10=10{ω^(ω^(ω^ω))}10=10{ω^(ω^(ω^10))}10=... (ε₀[n+1]=ω^(ε₀[n]), final operand 10)
710
+ 10{ω^(ω^2)}4=10{(ω^(ω^2))[4]}4=10{ω^(ω×4)}4=10{(ω^(ω×4))[4]}4=10{ω^(ω×3+4)}4=10{(ω^(ω×3+4))[4]}4=10{ω^(ω×3+3)×4}4
711
+
712
+ 10{ε₀}4=10{ε₀[4]}4=10{ω^(ω^(ω^ω))}4=10{(ω^(ω^(ω^ω)))[4]}4=10{ω^(ω^(ω^4))}4
667
713
 
668
714
  # dlsdl's Letter Notation
669
715
 
@@ -825,7 +871,7 @@ We can, of-course, repeat what we did in the previous section as many times as w
825
871
 
826
872
  (iii) 10{ω\*β+α}10 = 10{ω\*β+int(α)+1}2\*5^frac(α)
827
873
 
828
- (iv) 10{ω\*(β+1)}α = 10{ω\*β+α}10
874
+ (iv) 10{ω\*(β+1)}α = 10{(ω\*(β+1))[α]}α = 10{ω\*β+α}α
829
875
 
830
876
  Note that {ω\*β+γ} is a valid extended arrow operation. Also, in this new notation we can write Baα = 10{ω+α}10, Bbα = 10{ω\*2+1}α,... Bzα = 10{ω\*2+25}α.
831
877
 
@@ -841,7 +887,7 @@ Containing a very neat trick that allows us to do the double-diagonalization wit
841
887
 
842
888
  At any rate, it isn't too difficult to see that Aaa behaves "nicely" and allows us to speak of Aaa Canonical Forms of any number. Aaa1=Aa10, Aaa2=Ba10, ..., Aaa26=Za10 take the foundamental sequences.
843
889
 
844
- This also enables us to write the unversal Binary-Letter-Canonical form of any number up to Aaa: αAaaβ = 10{ω^2}(log5(α/2)+β). Since 10{ω^2}1=10{ω}10, 10{ω^2}2=10{ω\*2}10, α in αAaaβ has a range of [2,10).
890
+ This also enables us to write the unversal Binary-Letter-Canonical form of any number up to Aaa: αAaaβ = 10{ω^2}(log5(α/2)+β). The limit examples are 10{ω^2}1=10{ω}1 and 10{ω^2}2=10{ω\*2}2. The mantissa range [2,10) follows from log5(α/2)∈[0,1): α=2 starts a unit interval, while the excluded α=10 endpoint is carried into β+1; it does not depend on giving these limit expansions a final operand 10.
845
891
 
846
892
  ## Symbol and letter notation
847
893
 
@@ -855,7 +901,7 @@ Extended arrow operations can be easily extended, like so:
855
901
 
856
902
  (iii) 10{...+ω^3\*β+ω^2\*γ+ω\*δ+α}10 = 10{...+ω^3\*β+ω^2\*γ+ω\*δ+int(α+1)}2\*5^frac(α)
857
903
 
858
- (iv) 10{(...+ω^3\*β+ω^2\*γ+ω\*δ+μ+1)\*ω^κ}α = 10{(...+ω^4\*β+ω^3\*γ+ω^2\*δ+ω\*μ+α)\*ω^(κ-1)}10
904
+ (iv) For a limit ordinal μ, 10{μ}α = 10{μ[α]}α. In particular, 10{(...+ω^3\*β+ω^2\*γ+ω\*δ+μ+1)\*ω^κ}α = 10{(...+ω^4\*β+ω^3\*γ+ω^2\*δ+ω\*μ+α)\*ω^(κ-1)}α
859
905
 
860
906
  (v) 10{(...+ω^3\*β+ω^2\*γ+ω\*δ+α)\*ω^κ}10 = 10{(...+ω^4\*β+ω^3\*γ+ω^2\*δ+ω\*int(α)+frac(α)\*10)\*ω^κ}10
861
907
 
@@ -911,7 +957,7 @@ Then we can define (the β-th symbol or symbol combination)Aaα = 10{ω^ω^...^(
911
957
 
912
958
  Implementation of dlsdl's letter notation for large number library, currently metanum.js
913
959
 
914
- the letter notations follow **diagonal letters**: names ending in `a` (`Aa` = ω, `Ba` = ω·2, `Aaa` = ω², …) carry the mantissa `α = 2·5^f ∈ [2,10)`: `10{ω*3}100=10{ω*2+100}10` → `2.000Ca100`, `10{ω^2}100=10{ω*100}10` → `2.000Aaa100`. And mantissa `α∈[1,10)` for the other letters: `10{ω*3+1}100=10{ω*3}^99 10` → `1.000Cb100`
960
+ the letter notations follow **diagonal letters**: names ending in `a` (`Aa` = ω, `Ba` = ω·2, `Aaa` = ω², …) carry the mantissa `α = 2·5^f ∈ [2,10)`: `10{ω*3}100=10{ω*2+100}100` → `2.000Ca100`, `10{ω^2}100=10{ω*100}100` → `2.000Aaa100`. And mantissa `α∈[1,10)` for the other letters: `10{ω*3+1}100=10{ω*3}^99 10` → `1.000Cb100`
915
961
 
916
962
  ## format options
917
963
 
@@ -928,7 +974,7 @@ the letter notations follow **diagonal letters**: names ending in `a` (`Aa` = ω
928
974
  repeatLetterThreshold // 10. =n then n repeated single letters use next letter notation
929
975
  multiLetterDigits // 11. α's decimal places in αAaβ,αAbβ...αAaaβ and above
930
976
  multiLetterRepeatThreshold// 12. =n then n repeated multi letter combinations use next letter notation
931
- multiLetterLimit // 13. =n then length of multi letter combinations does not exceed n, exceed then switch to next notation (length of Aa~Zz is 2, Aaa~Zzz is 3, Aaaa~Zzzz is 4...)
977
+ multiLetterLimit // 13. Ordinary multi-letter combinations of length <=n are kept; longer ordinary combinations switch to the next notation. Exact diagonal tokens required for parse/format round-trips (for example Aaaaa10 when n=4) are exempt. The existing 64-token safety cap still applies.
932
978
  epsilonSignificantDigits // 14. α's decimal places in αεβ
933
979
  ```
934
980
 
@@ -950,7 +996,7 @@ the letter notations follow **diagonal letters**: names ending in `a` (`Aa` = ω
950
996
  …………
951
997
 
952
998
  - 10{22}(repeatLetterThreshold+1) ~ 10{23}(repeatLetterThreshold+1): αZβ format; ZαEβ, ZEαEβ, ……, ZαZβ, ZZαZβ,…… format
953
- - 10{23}(repeatLetterThreshold+1) ~ 10{10^sciThreshold}10(=10{ω}(10^sciThreshold)): αAaβ format
999
+ - 10{23}(repeatLetterThreshold+1) ~ 10{10^sciThreshold}(10^sciThreshold)(=10{ω}(10^sciThreshold)): αAaβ format
954
1000
  - 10{ω}(10^sciThreshold) ~ 10{ω+1}(multiLetterRepeatThreshold+1): AaαEβ, ……, AaαAaβ, AaAaαAaβ…… format
955
1001
  - 10{ω+1}(multiLetterRepeatThreshold+1) ~ 10{ω+1}(10^sciThreshold): αAbβ format
956
1002
  - 10{ω+1}(10^sciThreshold) ~ 10{ω+2}(multiLetterRepeatThreshold+1): AbαEβ, ……, AbαAbβ, AbAbαAbβ…… format
@@ -960,19 +1006,19 @@ the letter notations follow **diagonal letters**: names ending in `a` (`Aa` = ω
960
1006
 
961
1007
  - 10{ω+25}(multiLetterRepeatThreshold+1) ~ 10{ω+25}(10^sciThreshold): αAzβ format
962
1008
  - 10{ω+25}(10^sciThreshold) ~ 10{ω+26}(multiLetterRepeatThreshold+1): AzαEβ to AzαAzβ, AzAzαAzβ…… format
963
- - 10{ω+26}(multiLetterRepeatThreshold+1) ~ 10{ω+10^sciThreshold}10(=10{ω×2}(10^sciThreshold)): αBaβ format
1009
+ - 10{ω+26}(multiLetterRepeatThreshold+1) ~ 10{ω+10^sciThreshold}(10^sciThreshold)(=10{ω×2}(10^sciThreshold)): αBaβ format
964
1010
  - 10{ω×2}(10^sciThreshold) ~ 10{ω×2}(multiLetterRepeatThreshold+1): BaαEβ to BaαBaβ, BaBaαBaβ…… format
965
1011
 
966
1012
  …………
967
1013
 
968
- - 10{ω×2+26}(multiLetterRepeatThreshold+1) ~ 10{ω×2+10^sciThreshold}10(=10{ω×3}(10^sciThreshold)): αCaβ format
1014
+ - 10{ω×2+26}(multiLetterRepeatThreshold+1) ~ 10{ω×2+10^sciThreshold}(10^sciThreshold)(=10{ω×3}(10^sciThreshold)): αCaβ format
969
1015
  - 10{ω×3}(10^sciThreshold) ~ 10{ω×3}(multiLetterRepeatThreshold+1): CaαEβ to CaαCaβ, CaCaαCaβ…… format
970
1016
 
971
1017
  …………
972
1018
 
973
1019
  - 10{ω×26+25}(multiLetterRepeatThreshold+1) ~ 10{ω×26+25}(10^sciThreshold): αZzβ format
974
1020
  - 10{ω×26+25}(10^sciThreshold) ~ 10{ω×26+26}(multiLetterRepeatThreshold+1): ZzαEβ to ZzαZzβ, ZzZzαZzβ…… format
975
- - 10{ω×26+26}(multiLetterRepeatThreshold+1) ~ 10{ω×(10^sciThreshold)}10(=10{ω^2}(10^sciThreshold)): αAaaβ format
1021
+ - 10{ω×26+26}(multiLetterRepeatThreshold+1) ~ 10{ω×(10^sciThreshold)}(10^sciThreshold)(=10{ω^2}(10^sciThreshold)): αAaaβ format
976
1022
  - 10{ω^2}(10^sciThreshold) ~ 10{ω^2}(multiLetterRepeatThreshold+1): AaaαEβ to AaaαAaaβ, AaaAaaαAaaβ…… format
977
1023
 
978
1024
  …………
@@ -1010,7 +1056,7 @@ format(MetaNum.arrow(4, 4, 4)); // "GGFF2.187F3" (GG + FF…F…; raw
1010
1056
  format(MetaNum.arrow(3, MetaNum.arrow(3, 4, 3), 3)); // "AaG2.045G2" (Aa + G…G…)
1011
1057
  format(MetaNum([[3638334640023.7783, 7625597484984, 0, 1, 1]])); // "HG2.045G2" (H + G…G…)
1012
1058
  format(MetaNum("AaGGFFE8.072E153")); // "AaGG3.340G3"
1013
- format(MetaNum("AbGGFFE8.072E153")); // "AbGG3.340G3" (Ab / Ba / Bb / Aaa behave the same)
1059
+ format(MetaNum("AbGGFFE8.072E153")); // "AbGG3.340G3" (Ab / Ba / Bb / Aaa apply the same rules while preserving their own prefixes)
1014
1060
  format(MetaNum("AaaGF7.626E12")); // "AaaG2.045G2"
1015
1061
  ```
1016
1062
 
@@ -1042,6 +1088,23 @@ formatFull(MetaNum("AaGGFFE8.072E153")); // "AaGGFFE8.072E153" (
1042
1088
  format(MetaNum("AaGGFFE8.072E153")); // "AaGG3.340G3" (2 types)
1043
1089
  ```
1044
1090
 
1091
+ ### Formatting helper API
1092
+
1093
+ The following existing exports provide convenience formatting and structural analysis. Import them from `format-metanum.js` alongside `format`.
1094
+
1095
+ | Export | Purpose and input | Output and example | Limits |
1096
+ |---|---|---|---|
1097
+ | `formatWhole(num)` | Formats a MetaNum input with precision 0. | String; `formatWhole(MetaNum(1234.56))` → `"1,234"`. | Still follows `FORMAT_OPTIONS`, including commas and notation thresholds. |
1098
+ | `formatSmall(num, precision = 2)` | Formats a MetaNum input through the small-value entry point with optional precision. | String; `formatSmall(MetaNum(0.0001))` → `"1.000E-4"`. | Scientific and reciprocal forms still depend on the other format options. |
1099
+ | `metaPolarize(r0, num)` | Analyzes an r0 row such as `[base,e,f,g,...]`; `num` is a retained compatibility argument. | Approximate `{bottom,top,height,repeat}`; `metaPolarize([100])` → `{bottom:1,top:2,height:1,repeat:1}`. | This is a display structure, not a new MetaNum or an exact inverse; an empty row is treated as `[0]`. |
1100
+ | `letterName(height)` | Maps a numeric level to E…Z, Aa…Zz, Aaa… | String; `letterName(699)` → `"Aaa"`. | Heights below 1 fall back to `E`; very large heights are limited by JavaScript numeric precision and string capacity. |
1101
+ | `symbolName(layer)` | Maps a symbol layer to the existing symbol table. | String; `symbolName(1)` → `"!"`, `symbolName(0)` → `""`. | Non-positive layers and layers beyond the explicit table return an empty string, not ε text. |
1102
+ | `getOrdinalLetter(ordRows)` | Recovers a nameable letter prefix from ordinal rows. | String or `null`; `getOrdinalLetter([[1,0,0,1]])` → `"Aaa"`. | Empty or unnameable input can return `null`; two-element ω-level rows map to `Aa`. |
1103
+ | `formatR0AsChain(r0, precision, used)` | Formats an r0 row as a letter chain; `used` is the caller's consumed repetition budget. | String or `null`; `formatR0AsChain([10,1,2],3)` → `"FF1.000E10"`. | Insufficient repetition budget can return `null`; ordinary `format` may further reduce the chain to two letter types. |
1104
+ | `polarizeFiniteChain(r0, finiteRows)` | Recovers display parameters from a finite r0/ordinal-row chain. | Approximate `{bottom,repeation,arrows}` or `null`; for `v=MetaNum.arrow(3,100,3)`, `polarizeFiniteChain(v.array[0],v.array.slice(1))` → `{bottom:≈2.375812,repeation:2,arrows:99}`. | Unrecoverable chains return `null`; values are approximate and the public field spelling `repeation` is retained. |
1105
+ | `gammaArgOf(v, level, iters = 60)` | Uses bisection on the smooth arrow curve to recover x in `10{level}x=v`. | Approximate number or `null`; `gammaArgOf(MetaNum("G5"),3,40)` → approximately 5. | The result is a double approximation, not necessarily an integer; exceeding the expansion guard returns `null`. |
1106
+ | `formatGammaBinary(x, level, precision)` | Formats an already recovered numeric argument as αΓβ. | String; `formatGammaBinary(5.5,3,3)` → `"3.162G5"`. | Precision, commas, and mantissa details follow `FORMAT_OPTIONS`; this function does not prove that x is recoverable. |
1107
+
1045
1108
  **Canonical chain** (README “Letter-Canonical Forms”): every number > 1 is `Γα` for
1046
1109
  a unique α at each letter Γ, so the universal spelling walks
1047
1110
 
@@ -1085,8 +1148,9 @@ Every hyperoperation is stored EXACTLY while it fits the array budget and approx
1085
1148
 
1086
1149
  # Changelog
1087
1150
 
1151
+ - 2026-11-24 v2.2.0 Unify limit rules and fractional continuity; add iteraperiate with log/root inverses and ordinal-level root forms; fix formatting and large-base ordinal growth beyond y=100
1088
1152
  - 2026-10-24 v2.1.2 Fix(format): `format` now caps every display at TWO letter combinations with an αΓβ binary tail
1089
- - 2026-10-18 v2.1.1 Fix: round-trip @Aa1/#Aa1 and alpha-Gamma sub-unit forms; fix(format): exact token form for non-integer multi-a layers and past multiLetterLimit
1153
+ - 2026-10-18 v2.1.1 Fix round-trip @Aa1/#Aa1 and alpha-Gamma sub-unit forms; ordinary combinations beyond multiLetterLimit carry to the next notation, while exact diagonal tokens required for round-trips remain exempt
1090
1154
  - 2026-10-16 v2.1.0 Add hardy(x, base) and FGH(x, base), fix issue #15, #17, #19, #20, #21, #22
1091
1155
  - 2026-9-30 v2.0.2 Fix a lot of bugs e.g. hardy(non integer > 1000) throwing, hardy beyond the 1.8e308 range fails, format of "ω^n\*large numbers" fails, some FORMAT_OPTIONS not take effect
1092
1156
  - 2026-9-25 v2.0.1 Fix arrow(x,y,y) not being monotone in y and array except array[0][0] may be non-integer
package/format-metanum.js CHANGED
@@ -1,5 +1,5 @@
1
- // Author: dlsdl v2.1.2
2
- // v2.1.2 Fix(format): `format` now caps every display at TWO letter combinations with an αΓβ binary tail
1
+ // Author: dlsdl v2.2.0
2
+ // v2.2.0: Unify limit rules and fractional continuity; add iteraperiate with log/root inverses and ordinal-level root forms; fix formatting and large-base ordinal growth beyond y=100
3
3
  // Code snippets and templates from format-omeganum.js
4
4
  // Uses dlsdl's Letter Notation (see README.md)
5
5
 
@@ -849,6 +849,37 @@ function formatLayer(num, precision, precision2, precision3, precision4) {
849
849
  return innerStr + "ε" + commaFormat(num.layer)
850
850
  }
851
851
 
852
+ // ω^ω-family tail-CNF markers (a single Aa row [1,0,1] at a symbol layer):
853
+ // r0[0] is the ω^0 coefficient (the integer-form argument) and r0[j] (j≥1,
854
+ // non-negative integers) are the E/F/G/H-form digits — E↔ω^ω+ω^1, F↔ω^2,
855
+ // G↔ω^3, … — matching the parser's finOps convention (!AaE16 → r0=[16,1],
856
+ // layer 1). Emitted as "!2.000Aa" + E×c1 + F×c2 + … + c0 so the string
857
+ // round-trips exactly through the symPrefix/finOps parse path.
858
+ if (num.layer >= 1 && num.array.length === 2 &&
859
+ num.array[1].length === 3 &&
860
+ num.array[1][0] === 1 && num.array[1][1] === 0 && num.array[1][2] === 1 &&
861
+ num.array[0].length >= 2) {
862
+ let finR0 = num.array[0]
863
+ let finLetters = ""
864
+ let finOk = true
865
+ for (let fj = 1; fj < finR0.length; fj++) {
866
+ let fc = finR0[fj]
867
+ if (typeof fc !== "number" || fc !== Math.floor(fc) || fc < 0 || fc > 26 || fj > 22) { finOk = false; break }
868
+ if (fc > 0) finLetters += letterName(fj).repeat(fc)
869
+ }
870
+ let finC0 = finR0[0]
871
+ // c0 must be an integer: a non-integer c0 with higher digits is a
872
+ // height tower chain (e.g. iterate(3,1.5e16) → r0=[16.176,1]), not a
873
+ // tail-CNF marker — leave those to the legacy chain format.
874
+ if (finOk && typeof finC0 === "number" && isFinite(finC0) && finC0 >= 0 &&
875
+ finC0 === Math.floor(finC0) && finC0 < 1e15) {
876
+ let c0Str = (finC0 === Math.floor(finC0)) ? String(finC0) : String(Math.round(finC0 * 1e12) / 1e12)
877
+ if (!/e/i.test(c0Str)) {
878
+ return sym + regularFormat(2, precision4) + "Aa" + finLetters + c0Str
879
+ }
880
+ }
881
+ }
882
+
852
883
  // The 10{ω^n}10 cascade at a symbol layer — the stored form of @Aa<n> (layer 1), #Aa<n> (layer 2), index is the total ω^-layer count.
853
884
  let cascadeStr = formatAaCascade(inner, precision4)
854
885
  if (cascadeStr !== null) {
@@ -1133,7 +1164,12 @@ function formatR0AsChainRaw(r0, precision, used) {
1133
1164
  if (innerR0[maxLevel] === 0) {
1134
1165
  innerR0 = innerR0.slice(0, maxLevel)
1135
1166
  }
1136
- let innerStr = formatR0AsChain(innerR0, precision, true)
1167
+ let innerStr = formatR0AsChain(innerR0, precision, usedCount)
1168
+ if (innerStr === null) {
1169
+ // inner chain cannot spell within the repeat budget: fall through
1170
+ // to the Γ-canonical collapse below (concatenating null would
1171
+ // print "αΓnull")
1172
+ } else {
1137
1173
  let hasLetter = /[A-Z]/.test(innerStr)
1138
1174
  if (!hasLetter) {
1139
1175
  let base = r0[0]
@@ -1179,6 +1215,7 @@ function formatR0AsChainRaw(r0, precision, used) {
1179
1215
  }
1180
1216
  }
1181
1217
  }
1218
+ }
1182
1219
  }
1183
1220
 
1184
1221
  // (b) collapse: the structural chain (n repeats of the top letter Γᵀ on an inner value whose canonical letter is Γᵀ⁺¹, e.g. F^895(G(2.06))) compresses to ONE Γᵀ⁺¹ with arg+n
@@ -1696,8 +1733,8 @@ function formatOrdinal(num, precision, precision4) {
1696
1733
  // Repeated Aa below threshold: use AaAa... prefix
1697
1734
  let tokAa = letterTokenOf(baseHeight)
1698
1735
  if (tokAa.sym) {
1699
- // multiLetterLimit symbol carry: the diagonal letter reads as one more symbol with the chain as its argument
1700
- return composeLetterChain(tokAa.sym + regularFormat(2, precision4) + tokAa.letter,
1736
+ // multiLetterLimit symbol carry: the diagonal letter reads as one more symbol with the chain as its argument — the chain keeps the only mantissa
1737
+ return composeLetterChain(tokAa.sym + tokAa.letter,
1701
1738
  r0, argStr, precision4)
1702
1739
  }
1703
1740
  // past the collapse threshold the repeats shift the argument and advance the letter
@@ -1712,11 +1749,12 @@ function formatOrdinal(num, precision, precision4) {
1712
1749
  }
1713
1750
  return composeLetterChain(letter.repeat(totalAaCount), r0, repArgStr, precision4)
1714
1751
  } else {
1715
- // Single Aa
1752
+ // Single Aa. When the name carries to the symbol form (!H = the
1753
+ // ω^4 diagonal), the r0 chain already carries its own mantissa —
1754
+ // keep only the LAST mantissa (issue: "!2.000H1.500E16" had two).
1716
1755
  let tokAa = letterTokenOf(baseHeight)
1717
1756
  if (tokAa.sym) {
1718
- return composeLetterChain(tokAa.sym + regularFormat(2, precision4) + tokAa.letter,
1719
- r0, argStr, precision4)
1757
+ return composeLetterChain(tokAa.sym + tokAa.letter, r0, argStr, precision4)
1720
1758
  }
1721
1759
  return composeLetterChain(letter, r0, argStr, precision4)
1722
1760
  }
@@ -1885,12 +1923,16 @@ function formatOrdinal(num, precision, precision4) {
1885
1923
  r0Str, precision4)
1886
1924
  }
1887
1925
  if (totalRepeat >= collapseAt) {
1888
- // Collapse to next letter — the repeat count shifts the argument, so the mantissa keeps the [1,10) convention
1926
+ // Collapse to next letter — the repeat count shifts the argument:
1927
+ // the parameter is the integer repeat index and the r0 tower folds
1928
+ // into the mantissa (αΓβ = Γ(β+log α)), never spelling the r0
1929
+ // chain as a second tail: explode(3^^^3,1187)'s row [1186,0,2]
1930
+ // → "6.002Bb1186", not "6.002BbF7.626E12".
1889
1931
  let mantissa = Math.log10(Math.max(alpha, 0.001)) + totalRepeat
1890
1932
  let newLetter = letterName(baseLetterHeight + 1)
1891
- let mantVal = diagonalMantissa(newLetter, mantissa)
1892
- return composeLetterChain(regularFormat(mantVal, precision4) + newLetter,
1893
- r0, r0Str, precision4)
1933
+ let betaInt = Math.floor(mantissa)
1934
+ return regularFormat(diagonalMantissa(newLetter, mantissa), precision4) +
1935
+ newLetter + commaFormat(betaInt)
1894
1936
  } else if (totalRepeat > 1) {
1895
1937
  // Repeated letters + chain: one token per application, the innermost one in front of the chain (Ba(Ba(1e16)) → the stacked "BaBa1.000E16" — apea(apea(a)) must stay visible)
1896
1938
  let outerLetters = letter.repeat(totalRepeat)