quaeratin
Version:
An extended precision floating point library (as per Shewchuk) - precision only limited by overflow / underflow
19 lines (18 loc) • 890 B
TypeScript
/**
* Returns the result of compressing the given floating point expansion.
*
* * primarily for internal library use
*
* * see [Shewchuk](https://people.eecs.berkeley.edu/~jrs/papers/robustr.pdf)
*
* Theorem 23 (Shewchuck): Let e = sum_(i=1)^m(e_i) be a nonoverlapping
* expansion of m p-bit components, where m >= 3. Suppose that the components of
* e are sorted in order of increasing magnitude, except that any of the e_i may
* be zero. Then the following algorithm will produce a nonoverlapping expansion
* (nonadjacent if round-to even tiebreaking is used) such that
* h = sum_(i=1)^n(h_i) = e, where the components h_i are in order of increasing
* magnitude. If h != 0, none of the h_i will be zero. Furthermore, the largest
* component h_n approximates h with an error smaller than ulp(h_n).
*/
declare function eCompress(e: number[]): number[];
export { eCompress };