approximation_error

std.elementwise.approximation_error · Level L1

The errors of an approximation a to a reference value x: the absolute error |a − x|; the relative error |a − x|/|x|, defined only when x ≠ 0 (has_rel says whether it is, and rel is 0 otherwise); and whether |a − x| ≤ τ for the tolerance τ ≥ 0, as 1 or 0. Truncation, rounding and data error are different sources and are not interchangeable.

|a − x|, |a − x|/|x|, [|a − x| ≤ τ]

Signature

approximation_error(a: f64[n], x: f64[n], tol: f64[]) → f64[n], f64[n], f64[n], 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.

af64[n]xf64[n]0.0tolf64[]SubtractdSubtractnxSubtractndMaximumaxMaximumabs_errorEqualx01.0AddsafeGreateroverSubtracthas_relDividerel_rawSubtractwithinMultiplyrel_errorabs_errorf64[n]rel_errorf64[n]withinf64[n]has_relf64[n]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Equal to the reference the definitions, in exact arithmetic in exact rational arithmetic, on all 40 test cases.
  • All 680 float64 results inside the running error bound; the closest uses 43% 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 47% of it.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
98%
bit-equal to the NumPy formula in float64
100%
largest error, in units in the last place
1.18

Identity

Calls
—
Called by
—
sha256:e0b93249ace2bfae965354d22fe03eea08c091c75d3bcfe91468ee3ebec29107

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

Control handle

Symbol
Ω:std.elementwise.approximation_error · Ω:approximation_error
Pins
sha256:0e94b63a7241f71216a6afce954367cb06191556e3090420163f4cd2408fab9fthis graph alone
Evidence
sha256:2e8b4f49b0e94ed42deca13fe7d68fba168ead1dfd73939c57092731a938dd5dthe 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.