quaeratin
Version:
An extended precision floating point library (as per Shewchuk) - precision only limited by overflow / underflow
17 lines (16 loc) • 832 B
TypeScript
/**
* Returns the result of adding two expansions.
*
* Theorem 13: Let e = sum_(i=1)^m(e_i) and f = sum_(i=1)^n(f_i) be strongly
* nonoverlapping expansions of m and n p-bit components, respectively, where
* p >= 4. Suppose that the components of both e and f are sorted in order of
* increasing magnitude, except that any of the e_i or f_i may be zero. On a
* machine whose arithmetic uses the round-to-even rule, the following algorithm
* will produce a strongly nonoverlapping expansion h such that
* sum_(i=1)^(m+n)(e_i + f_i) = e + f, where the components of h are also in
* order of increasing magnitude, except that any of the h_i may be zero.
*
* See https://people.eecs.berkeley.edu/~jrs/papers/robustr.pdf
*/
declare function fastExpansionSum(e: number[], f: number[]): number[];
export { fastExpansionSum };