Skip to main content

first_exit

Function first_exit 

Source
pub fn first_exit<V: ValueAlgebra>(
    t0: &V,
    step: &V,
    guard: &V,
) -> Result<V, String>
Expand description

How many passes While <guard>: makes when each pass adds step to its counter, from t0: the first natural k at which the guard fails at t0 + k·step. The guard compares terms linear in the counter (the formula Guard::read takes), so its truth can change only where one of them crosses zero and otherwise repeats with the period of its remainders; its first failure lies at a crossing or within one period after one, and is found by evaluating the guard there alone. Where those points depend on the residue of the generator — ⌊1/(2·dt)⌋ — each class is read on its own scale and the count is the infinite integer the classes’ answers make.

−1 — not counted, so the loop runs as written — when every number is standard (the loop then ends after finitely many passes, or never, exactly as it is written), when one is not a number, and when a standard step never fails the guard; a refusal when an infinitesimal one never does.