Skip to main content

Module exact

Module exact 

Source
Expand description

Was this floating-point operation exact?

Three predicates, shared by everything that folds coefficients into a map and then has to answer whether the fold kept them. They were private to pounce-nl’s quadratic recognizer until gh #673 gave the .nl pipeline a second such fold — Σ 2wₖbₖbₖᵀ in pounce_nlp::quadratic::QuadraticStructure::push_factored_form — in a crate that cannot name the first. Duplicating them would have been two copies of the argument in gh #683, gh #685 and gh #687, free to drift.

The question they answer is never “is this close enough”. It is “did this add or multiply round at all”, answered exactly, so that a term that cancelled exactly (x − x, degree really 0) is told apart from one that was absorbed (2⁵³·x + x − 2⁵³·x, where the x is gone and the read-out would silently be short of it).

Functions§

add_is_exact
Was a + b, which came out as s, computed exactly?
is_live
Is this coefficient worth storing? Exact zeros are dropped so that degree and constant-folding questions stay O(1), and so that a term that cancelled cannot make a later product look like degree 3. NaN is dropped for the same reason.
mul_is_exact
Was a · b, which came out as p, computed exactly?