import { expansionProduct } from "./expansion-product.js"; import { twoProduct } from "../basic/two-product.js"; import { scaleExpansion } from "./scale-expansion.js"; import { twoSum } from "../basic/two-sum.js"; import { growExpansion } from "./grow-expansion.js"; import { fastExpansionSum } from "./fast-expansion-sum.js"; import { eCompress } from "./e-compress.js"; // We *have* to do the below❗ The assignee is a getter❗ The assigned is a pure function❗ const mult = expansionProduct; const tp = twoProduct; const multByDouble = scaleExpansion; const ts = twoSum; const addDouble = growExpansion; const add = fastExpansionSum; const compress = eCompress; /** * Return the result of summing an array of terms, each term being an array of * floating point expansions to be multiplied together. * * * 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 terms to be summed; A term consists of an * array of floating point expansions to be multiplied together. */ // 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 eCalculate(terms: number[][][]) { let total = [0]; for (let i=0; i