Module interval

Source
Expand description

Outward-rounded interval arithmetic: the fast tier.

Every result bound is the round-to-nearest f64 result moved one step outward. Round-to-nearest errs by at most half the gap to the adjacent float in the direction of the error, so one step (next_down / next_up) always covers the true value. This holds in the subnormal range, at binade boundaries (where the gap below is half the gap above, and so is the error), and on overflow (+inf rounded from a finite true value steps down to f64::MAX, which is still below it).

NaN never escapes as a bound: f64::min/max silently discard NaN, which would turn “unknown” into a confident wrong bound. Any NaN collapses the interval to the whole line, which is always sound and never decides a sign.

Structs§

Interval
A closed interval [lo, hi] known to contain the true value.