chi2_sf

std.stats.chi2_sf · Level L5

The chi-square distribution's upper tail with k degrees of freedom, the p-value of a chi-square statistic: Q(k/2, x/2), the regularized upper incomplete gamma function. A small p-value keeps its relative accuracy, where 1 − chi2_cdf would round it to 0.

P(X > x; k) = Q(k/2, x/2)

Signature

chi2_sf(x: f64[n], k: i64[]) → f64[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.

xf64[n]0.5ki64[]MultiplytMultiplyaGammaIncCqqf64[n]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Agrees with the reference closed forms for whole k: e^(−x/2)·Σ…, or erfc(√(x/2)) + …, summed directly to 80 digits (100-digit arithmetic), on all 40 test cases.
  • All 143 float64 results inside the running error bound; the closest uses 9% of it.
  • Interpreter and NumPy backend return bit-identical results.
  • At float32 too: the 40 test cases rounded to float32, and 40 of them inside the running error bound at u = 2⁻²⁴; the closest uses <1% of it.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
85%
largest error, in units in the last place
10

Large ulp counts appear where a result is tiny next to the numbers it is computed from (after cancellation, for example), so one unit in the last place is tiny too; the absolute error is still inside the bound. Results within their own error of zero are not counted.

Note

For whole degrees of freedom the upper tail has closed forms that are sums of positive terms, so the reference never subtracts from 1.

Identity

Calls
—
Called by
—
sha256:061156f5666d5d03d6e987874b5510b161d3b411966fd84a1a5cd0a54ad5b9be

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

Control handle

Symbol
Ω:std.stats.chi2_sf · Ω:chi2_sf
Pins
sha256:3af7cb1868121b6681b0c1afce102dab30adf3d5e76b7a01fa513ab5efc425d6this graph alone
Evidence
sha256:4ca80ac9e41278a8720c4f2adfbad0471472e4f4b9e29b2d20c7be432ceb1207the 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.