Version: dev

tolerance

Stable type · Document types

Tier: stable · Kind: type · Topic: Document types

JuliaTypeScriptPythonRustGo
not exportednot exportednot exportedToleranceTolerance

Julia

Julia does not export this type.

TypeScript

TypeScript does not export this type.

Python

Python does not export this type.

Rust

pub struct Tolerance {
    pub abs: Option<f64>,
    pub rel: Option<f64>,
}

Numerical comparison tolerance used by inline model tests.

Either or both of abs / rel may be set. An assertion passes when any set bound is satisfied: |actual - expected| <= abs OR |actual - expected| <= rel * max(|actual|, |expected|).

The relative bound is SYMMETRIC in actual and expected — its scale is the larger of the two magnitudes, not |expected| alone (Julia isapprox; esm-spec §6.6.3). inline_tests::check_assertion carries the full predicate, whose finiteness clause precedes the tolerance test.

Source · Rust docs

Go

type Tolerance struct {
	Abs *float64 `json:"abs,omitempty"`
	Rel *float64 `json:"rel,omitempty"`
}

Tolerance is a numerical comparison tolerance. Any of Abs/Rel may be set; an assertion passes when any set bound is satisfied:

|actual - expected| <= Abs   OR   |actual - expected| <= Rel * max(|actual|, |expected|)

The relative bound is SYMMETRIC in actual and expected – its scale is the larger of the two magnitudes, not |expected| alone (Julia isapprox; esm-spec 6.6.3). Finiteness is judged before tolerance: a non-finite actual fails against every finite expected. Go has no simulator, so this binding never evaluates the predicate; the contract is recorded here so a future runner does not have to re-derive it.

Source · Go docs