Best Use & Engineering Application Guide

Engineering Category: Exact Integer Number Theory & Transcendentals

Best Use in Production: Hardware-verified modular arithmetic, integer roots, and combinatorial invariants for exact rational math engines and cryptographic primitives.

When to Select This Capsule: Verified baseline member of a 3-capsule Equivalence Class; useful as a reference or cross-validation peer. Multi-step compute kernel (288519/625 cyc/op); best used at frame, block, or batch aggregation boundaries.

Snap-Circuit Wiring Role: 1-to-1 Unary Transform Stage `(u64)->u64` — snaps directly into linear pipelines or fan-out DAG branches.

Hardware _rdtsc: 288519/625 cycles/op
Latency: 10018371/80000 ns/op
Throughput: 80000000/10018371 ops/us
Compiled ELF64 .text: 115 B (34 x86_64 insns)
C64 64KB RAM Budget: 51/16384 (204 B source)
Ternary Vote: + (score 1) | Salience: 152215/1716
Pure-Rust Capsule Source Code (204 B)
pub const fn isqrt_u64(n: u64) -> u64 {
    if n < 2 {
        return n;
    }
    let mut x = n;
    let mut y = (x + 1) >> 1;
    while y < x {
        x = y;
        y = (x + n / x) >> 1;
    }
    x
}
rustc -C opt-level=3 x86_64 Disassembly (115 B .text / 34 insns)
isqrt_u64:
    cmp    rdi, 2
    jb    .LBB7_2
    lea    rax, [rdi + 1]
    shr    rax
    cmp    rax, rdi
    jb    .LBB7_8
.LBB7_2:
    mov    rcx, rdi
.LBB7_3:
    mov    rax, rcx
    ret
.LBB7_6:
    mov    rax, rdi
    xor    edx, edx
    div    rcx
    add    rax, rcx
    shr    rax
    cmp    rax, rcx
    jb    .LBB7_8
    jmp    .LBB7_3
.LBB7_4:
    mov    rcx, rax
    mov    rax, rdi
    or    rax, rcx
    shr    rax, 32
    jne    .LBB7_6
    mov    eax, edi
    xor    edx, edx
    div    ecx
    add    rax, rcx
    shr    rax
    cmp    rax, rcx
    jae    .LBB7_3
.LBB7_8:
    test    rax, rax
    jne    .LBB7_4
    push    rax
    lea    rdi, [rip + .Lanon.a270e05f789020653a98a620bea8a67e.4]
    call    qword ptr [rip + _RNvNtNtCscNqnBmBaIcL_4core9panicking11panic_const23panic_const_div_by_zero@GOTPCREL]

Head-to-Head Functional Equivalence Class Peers (3 Implementation(s) Matching 64 Test Vectors)

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#3isqrt_u64
domain: ayecast-x86_64 | id: 7f1678af7926c8e71ba451952565b4b1
482603/200000 cyc/op261913/400000 ns/op400000000/261913 ops/us115 B .text (34 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz
#4isqrt_u64
domain: smart-tree-x86_64 | id: 87992ac8869b3e30dc8fdd9177f22164
968409/400000 cyc/op525559/800000 ns/op800000000/525559 ops/us122 B .text (39 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz
#2035isqrt_u64 (THIS CAPSULE)
domain: ayecast-x86_64 | id: 701c3bcfc01cc58fa7b10bec31342152
288519/625 cyc/op10018371/80000 ns/op80000000/10018371 ops/us115 B .text (34 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz