Skip to main content

expansion_sum

Function expansion_sum 

Source
pub fn expansion_sum(
    e: &[f64],
    f: &[f64],
    h: &mut [f64],
) -> Result<usize, ExpansionError>
Expand description

Add two expansions: h = e + f.

e and f are input expansions, h is the output buffer (must have length >= e.len() + f.len()). Returns the number of components written to h (at most e.len() + f.len()).

Implements Shewchuk’s expansion_sum (§2.6): a merge that processes both expansions in order of increasing magnitude, using two_sum to maintain the non-overlapping + sorted invariant.

§Errors

Returns ExpansionError::OutputTooSmall if h.len() < e.len() + f.len().