binomial_quantile

std.stats.binomial_quantile · Level L5

The binomial distribution's quantile for n trials with success probability π: the smallest k in [0, n] with P(K ≤ k) ≥ p. A bisection on whole numbers (a While over binomial_quantile_step) from [0, n].

k = min{ k : I_{1−π}(n − k, k + 1) ≥ p }

Signature

binomial_quantile(p: f64[n], trials: i64[], prob: f64[]) → i64[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.

pf64[n]trialsi64[]probf64[]Reshapep10MultiplypzCastlo1Addhi1ConcatstartWhile·binomial_quantile_stepbracketSlicek1Reshapekki64[n]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Agrees with the reference k = 0; while Σ_{j≤k} C(n, j)·πʲ·(1 − π)ⁿ⁻ʲ < p: k += 1 to 80 digits (100-digit arithmetic), on all 40 test cases.
  • All 143 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

Note

The reference adds the binomial probabilities one by one until they reach p, so neither the incomplete beta function nor the bisection checks itself. The answer is exact unless p lies within the CDF's own error of F(k); the verification bounds that case.

Identity

sha256:23310666340a513d3b59e2ab41fd21430bdac438b2c3cd2b77484ed12747eef7

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 · Ω:binomial_quantile
Pins
sha256:7369e82749175a2c3897694d32d69fa9e07205ecf18194ec572f81fda7198d8fthis graph and the 2 it reaches through calls
Evidence
sha256:bec27c88434f73d9737e3d782f0b41bb6b8139f6410a5b627ed1e7e3aefe8e38the 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.