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 6% of it.
  • Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
81%
bit-equal to the NumPy formula in float64
100%
largest error, in units in the last place
9.03

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:7e1994126121a21a22d4198f4d53ef7a601bb21b61cc5d3425f0384665c4c5d3the 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.