binomial_quantile_step

std.stats.binomial_quantile_step · Level L5

One bisection step for the binomial quantile, on every element at once: where [lo, hi] is still open, mid = ⌊(lo + hi)/2⌋ moves lo up to mid + 1 if F(mid) < p, else hi down to mid. F(mid) is I_{1−π}(n − mid, mid + 1) below p = ½ and 1 − I_π(mid + 1, n − mid) above it. The body that binomial_quantile runs.

mid = ⌊(lo + hi)/2⌋; F(mid) < p ? [mid + 1, hi] : [lo, mid] where lo < hi

Signature

binomial_quantile_step(lohi: i64[2, n], p: f64[n], trials: i64[], prob: f64[]) → i64[2, n]

Structure

The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.

trialsi64[]lohii64[2, n]probf64[]1.0pf64[n]0.5SubtractqSliceloSlicehiSubtractrestGreaterhigh_pLessopenAddsum21FloorDivmidAddk1SubtractleftMaximumaBetaInclowerBetaIncupperLessshort_lowGreatershort_highWhereshortMultiplygo_upSubtractonef2Wherenew_loMultiplygo_downWherenew_hiConcatnextnexti64[2, n]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Agrees with the reference mid = (lo + hi) // 2; [mid + 1, hi] if Σ_{j≤mid} C(n, j)·πʲ·(1 − π)ⁿ⁻ʲ < p else [lo, mid] to 80 digits (100-digit arithmetic), on all 40 test cases.
  • All 306 int64 results are exact: the error is zero.
  • Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
correctly rounded (the int64 nearest the exact value)
100%
bit-equal to the NumPy formula in int64
100%
largest error, in units in the last place
0

Identity

Calls
—
Called by
sha256:19fe2686de15b310edb2097ac44e911859dba536b78849ec00aa090e090665d5

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.

Control handle

Symbol
Ω:std.stats.binomial_quantile_step · Ω:binomial_quantile_step
Pins
sha256:845fee24e3acbac9eda497500eda4e981bb0c59973f07c359bd226f2304651e9this graph alone
Evidence
sha256:97b3b2aac81542ed52dee8ae9094fd39c8238be72d285f421b421f175828cb1cthe hash of its verification record
Needs
no capability: a pure function

Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.

ΣEML 2026

Efficient New Language — a high-density semantic overlay for humans and AI agents.

This site’s demos run on the real EML toolchain, in your browser.

© 2026 EveMissLab (一言諾科技有限公司) / Neo.K. All rights reserved.