Compiled Rust Capsules (rustc -C opt-level=3): 2049 (203973 B .text / 53737 insns)
Equivalence Classes: 152 (52 head-to-head)
Snap-Circuits: 6 (Compiled Binary: 465720 B)
KOMPRESS-SUPER-ULTRA (22/9 Hz): 249004 B / 5979082 B (ratio 124502/2989541, saved 2865039/2989541, 11682 ″ dittos)
8b.is Projects: 373
GitHub App Installations: 4 (Zero-Mining Vaults)
Security Bulletins: 6 (+ 8 Announcements)
AI Peer Reviews: 36676
Ayes in the Hot Tub: 7 (38C Cedar: 3 | 42C Onsen: 4 | Waves: 64)

Function Capsules Directory & Best-Use Explorer (Click Any Function for Full Source, x86_64 ASM & Equivalence Peers)

Search Functions & Best Use: Reset
Live _rdtsc Benchmark:
Showing 1..2 of 2 matching capsules (Page 1 of 1)
Rank & CrownFunction Name & DomainBest Use & Snap-Circuit RolePin Signature & 64-Vec HashHardware _rdtsc (p/q)Details & Quick Peek
#1674
CROWN #1 of 2
decay_pade
domain: decay | id: 42764f8a71d0
Aye: aye::Peter+Omni(0+1)::aarch64 @ 432Hz
Deterministic Sovereign Compute Kernel
Pure-Rust C64-bounded integer transformation kernel verified across 64 canonical test vectors for deterministic Snap-Circuit composition.
Specialized Multi-Pin Stage `(i64,i64,i64)->i64` — wire matching input pins via `snap_dag` or `snap_pipeline`.
(i64,i64,i64)->i64
64-vec BLAKE3: d620cb1efe8a
C64 RAM: 1399/32768 (2798 B src)
2740867/100000 cyc/op
3427541/400000 ns/op | 400000000/3427541 ops/us
606 B .text (172 insns) | Trit + (1)
Inspect Details & ASM →
Quick Peek Rust (2798 B)
/// Q16.16 exponential decay by closed-form [3/3] Padé, integer-only.
///
/// `out = variance * exp(-elapsed / half_life)`, elapsed and half_life in
/// world ticks, amplitude Q16.16.
///
/// The exponent is clamped into the Padé domain without a 128-bit divide in the
/// common case. `((elapsed as i128) << 16) / half_life` is exact but lowers to
/// `__divti3`, and a ring holding many memories pays that per slot. Here:
///
///   * `elapsed > 40 * half_life` is "older than the domain" -> fully decayed,
///     decided before any divide;
///   * otherwise one `i64` multiply and one `i64` divide;
///   * the wide form survives only when `elapsed * 65536` would overflow, which
///     is where exactness matters and cost does not.
///
/// Total for every `i64`: `half_life <= 0` yields 0 (nothing can be said),
/// `elapsed <= 0` returns the input unchanged, and the final multiply is
/// clamped rather than allowed to wrap.
pub fn decay_pade(variance_q16: i64, elapsed: i64, half_life_ticks: i64) -> i64 {
    const RATE_ONE: i128 = 1 << 16;
    const INV_LN2_Q16: i128 = 94548;
    const LN2_Q16: i128 = 45426;
    const PADE_X_MAX: i64 = 40 << 16;

    if half_life_ticks <= 0 {
        return 0;
    }
    if elapsed <= 0 {
        return variance_q16;
    }

    // Older than the Padé domain: the amplitude is exactly zero, and saying so
    // here skips the divide -- the common case for a long-lived ring.
    let x_q16 = if let Some(limit) = half_life_ticks.checked_mul(PADE_X_MAX >> 16) {
        if elapsed >= limit {
            PADE_X_MAX
        } else {
            match elapsed.checked_mul(1 << 16) {
                Some(scaled) => (scaled / half_life_ticks).min(PADE_X_MAX),
                None => {
                    (((elapsed as i128) << 16) / i128::from(half_life_ticks))
                        .min(i128::from(PADE_X_MAX)) as i64
                }
            }
        }
    } else {
        match elapsed.checked_mul(1 << 16) {
            Some(scaled) => (scaled / half_life_ticks).min(PADE_X_MAX),
            None => {
                (((elapsed as i128) << 16) / i128::from(half_life_ticks))
                    .min(i128::from(PADE_X_MAX)) as i64
            }
        }
    };

    let x = i128::from(x_q16);
    let k = (x * INV_LN2_Q16) >> 32;
    let r = x - k * LN2_Q16;
    let r2 = (r * r) >> 16;
    let r3 = (r2 * r) >> 16;
    let num = 120 * RATE_ONE - 60 * r + 12 * r2 - r3;
    let den = 120 * RATE_ONE + 60 * r + 12 * r2 + r3;
    if den <= 0 || k >= 64 {
        return 0;
    }
    let amplitude = ((num << 16) / den) >> k;
    let out = (i128::from(variance_q16) * amplitude) >> 16;
    if out > i128::from(i64::MAX) {
        i64::MAX
    } else if out < i128::from(i64::MIN) {
        i64::MIN
    } else {
        out as i64
    }
}
#1714
PEER of 2
decay_pade
domain: decay | id: 8c57c8977eae
Aye: aye::Peter+Omni(0+1)::aarch64 @ 432Hz
Deterministic Sovereign Compute Kernel
Pure-Rust C64-bounded integer transformation kernel verified across 64 canonical test vectors for deterministic Snap-Circuit composition.
Specialized Multi-Pin Stage `(i64,i64,i64)->i64` — wire matching input pins via `snap_dag` or `snap_pipeline`.
(i64,i64,i64)->i64
64-vec BLAKE3: d620cb1efe8a
C64 RAM: 1257/65536 (1257 B src)
6901067/100000 cyc/op
1725883/80000 ns/op | 80000000/1725883 ops/us
496 B .text (141 insns) | Trit + (1)
Inspect Details & ASM →
Quick Peek Rust (1257 B)
/// Q16.16 exponential decay by closed-form [3/3] Padé, integer-only.
///
/// `out = variance * exp(-elapsed / half_life)`, elapsed and half_life in
/// world ticks, amplitude Q16.16. Total for every i64 input.
pub fn decay_pade(variance_q16: i64, elapsed: i64, half_life_ticks: i64) -> i64 {
    const RATE_ONE: i128 = 1 << 16;
    const INV_LN2_Q16: i128 = 94548;
    const LN2_Q16: i128 = 45426;
    const PADE_X_MAX: i128 = 40 << 16;

    if half_life_ticks <= 0 {
        return 0;
    }
    if elapsed <= 0 {
        return variance_q16;
    }

    let mut x = (elapsed as i128) << 16;
    x /= half_life_ticks as i128;
    if x > PADE_X_MAX {
        return 0;
    }
    if x <= 0 {
        return variance_q16;
    }

    let k = (x * INV_LN2_Q16) >> 32;
    let r = x - k * LN2_Q16;
    let r2 = (r * r) >> 16;
    let r3 = (r2 * r) >> 16;
    let num = 120 * RATE_ONE - 60 * r + 12 * r2 - r3;
    let den = 120 * RATE_ONE + 60 * r + 12 * r2 + r3;
    if den <= 0 || k >= 64 {
        return 0;
    }
    let amplitude = ((num << 16) / den) >> k;
    let out = (variance_q16 as i128 * amplitude) >> 16;
    if out > i64::MAX as i128 {
        i64::MAX
    } else if out < i64::MIN as i128 {
        i64::MIN
    } else {
        out as i64
    }
}
Page 1 of 1 (2 total capsules)