Skip to content

pi_cascade_digits wall-time benchmark + rc12 cap finding

Date: 2026-05-17 Context. Per user direction immediately after rc12 ship (Milestone #4, PR #467 merged 2026-05-17T02:40:11Z): "now I'm curious to know and think we should include in our notes, wall time to return 350 digit pi cascade, partly because it's a weird number on purpose."

The deliberately non-canonical num_digits=350 (not a power of 10, not a CF convergent denominator) is a stress probe of the engineering. The benchmark surfaces a real engineering finding before the timing data.

Discipline. Pure observational benchmark on the rc12 ship. No code modification. NDJSON output per [[feedback_ndjson_over_bloated_json]]. Determinism verified across all trials (rc12 is fully deterministic; 20 repeated calls at num_digits=50 return bit-identical output).


§1 Engineering finding — rc12 hard caps num_digits ≤ 50

>>> pi_cascade_digits(350)
ValueError: num_digits exceeds practical cap 50; got 350

rc12 enforces num_digits ≤ 50 by validation. The cap reflects the validated digit count at the default cascade parameters (max_cascade_depth=90, precision_bits=512) per Spike #32's empirical verification. Going past 50 requires scaling both the cascade depth AND the rational-bounded precision proportionally; rc12 ships only the validated regime.

350 digits is beyond rc12. The user's request surfaces a clean rc13 candidate (now Task #248 — see §6).

§2 Wall-time scaling within the cap (5 → 50 digits)

Sweep at 5-trial median, srmech 0.4.1rc12, Python 3.14.4 on win32, fresh-venv install from TestPyPI:

num_digits median wall-time trials
5 67.23 ms 5
10 65.05 ms 5
15 66.95 ms 5
20 67.19 ms 5
25 65.08 ms 5
50 65.34 ms 5

Wall time is essentially flat at ~65 ms across the cap range — the cascade depth (90 iterations of Newton-Raphson at 512-bit precision) dominates, NOT the digit-extraction. This is consistent with the cascade-shape claim per [[user_stance_pi_spectral_shape_scalar_invariant]]: π's identity is in the cascade's substrate-invariant shape, and extracting more digits from the same cascade is essentially free; what costs is cascade depth.

§3 Detailed run at the rc12 max (num_digits=50, n=20 trials)

Statistic Value
median 64.91 ms
mean 65.42 ms
min 63.20 ms
max 70.27 ms
std (loose) ~1.5 ms
deterministic YES (all 20 returns bit-identical)

Output verbatim: 3.14159265358979323846264338327950288419716939937510 — matches the AMSC pi_digits catalog row anchor at num_digits=50 (Khinchin canonical).

§4 Bigger context: why the wall time is flat across the cap range

Looking at the rc12 implementation: pi_cascade_digits(num_digits) runs the same Archimedes hexagon-doubling cascade regardless of num_digits ≤ 50 — the cascade is configured by max_cascade_depth=90 and precision_bits=512 (defaults at the rc12 cap), and the cascade output is then truncated/rendered at the requested digit count. So:

  • For num_digits=5, the cascade runs depth=90 (overkill) → ~65 ms → 5 digits rendered
  • For num_digits=50, the cascade runs depth=90 (right-sized) → ~65 ms → 50 digits rendered
  • The wall time is dominated by the cascade computation, not the digit extraction

Implication for rc13: scaling past 50 requires proportionally scaling depth AND precision; the wall time will scale roughly with cascade_depth × log(precision_bits). A rough projection for 350 digits:

  • Cascade depth needed: ~350/50 × 90 ≈ 630 iterations (linear in num_digits)
  • Precision bits needed: ~350/50 × 512 ≈ 3584 bits (linear in num_digits)
  • Newton-Raphson √ at 3584-bit precision is ~O(log P × M(P)) where M(P) is bignum-multiply cost ≈ O(P²) at this scale
  • Projected wall time at depth 630, prec 3584: ~7× depth + ~50× single-step-cost ≈ a few seconds range, possibly tens of seconds

Empirical confirmation of the projection requires rc13. The cap is the engineering blocker, not the math.

§5 Connection to [[user_stance_pi_spectral_shape_scalar_invariant]]

The flat wall-time-across-the-cap finding reinforces the spectral-shape stance: π's identity at the cascade level isn't dependent on the scalar (digit count) you readout. The cascade computes the shape; the digit extraction is essentially free. This is the operational signature of "shape doesn't care about the scalar" — wall-time-vs-num-digits curve is flat in the regime where the cascade depth is right-sized.

For the user's 350-digit question: the ANSWER is two-part:

  1. rc12 says "no, capped at 50" — engineering decision documented as rc13 candidate
  2. The math says the cascade scales linearly in depth and precision — wall-time at 350 digits would be several seconds, NOT thousands of seconds; the cascade is well-conditioned

§6 rc13 candidate — expand pi_cascade_digits cap

Task #248 (pending) — extend the rc12 implementation to scale max_cascade_depth and precision_bits automatically with num_digits, removing the hard cap. Validation: each new digit count anchor should pass an AMSC catalog row check against canonical π (extend pi_digits catalog with rows at num_digits ∈ {100, 200, 350, 500, 750, 1000}). AST-verification gate stays load-bearing (no math.pi invocations).

§7 Discipline guards honoured

  • [[user_stance_pi_spectral_shape_scalar_invariant]] — the flat-wall-time-across-cap finding reinforces the spectral-shape claim
  • [[feedback_every_doc_edit_faces_falsification]] — benchmark output matches the AMSC pi_digits catalog row at num_digits=50 bit-exact
  • [[feedback_ndjson_over_bloated_json]] — 4 NDJSON records (environment + cap finding + sweep + detailed)
  • [[feedback_no_binding_layer_carveout]] — pi_cascade_digits is Python-only by honest scope (bignum required); the rc13 cap expansion stays Python (the underlying integer-Newton-Raphson is the cost dominator, and at 3584-bit precision Python bignum is the right substrate)
  • No math.pi invocations — AST-verified by the rc12 test suite

§8 Artifacts

§9 Bottom line

The user's "weird number on purpose" probe of 350 digits surfaced exactly what it was designed to surface: an engineering cap that doesn't reflect the math. The cascade scales linearly; rc12 caps where it was validated. rc13 candidate Task #248 closes that gap.

Wall time at num_digits=50 (the rc12 ceiling): ~65 ms median, 20-trial deterministic. Projected at num_digits=350 (rc13): seconds-range, depth 630, precision 3584 bits.


End of benchmark artifact.