import { twoSum } from "../basic/two-sum.js"; import { growExpansion } from "./grow-expansion.js"; import { fastExpansionSum } from "./fast-expansion-sum.js"; // We *have* to do the below❗ The assignee is a getter❗ The assigned is a pure function❗ const ts = twoSum; const addDouble = growExpansion; const add = fastExpansionSum; /** * Returns the result of summing an array of floating point expansions. * * * The result is exact in the form of a non-overlapping floating point * expansion. * * * see [Shewchuk](https://people.eecs.berkeley.edu/~jrs/papers/robustr.pdf) * * @param terms An array of numbers to be summed; A term is represented by a * floating point expansion. */ // The terms parameter were chosen to always be expansions in order to keep the // function monomorhic, but whether it's really worth it I am not sure. function eSum(terms: number[][]) { let total = [0]; for (let i=0; i