UNPKG

flo-poly

Version:

A practical, root-focused JavaScript polynomial utility library.

28 lines (21 loc) 541 B
import { twoSum as twoSum_ } from "big-float-ts"; // We *have* to do the below❗ The assignee is a getter❗ The assigned is a pure function❗ Otherwise code is too slow❗ const twoSum = twoSum_; /** * * helper function * * see http://www.ti3.tuhh.de/paper/rump/OgRuOi05.pdf * * @param x * @param K * * @internal */ function vecSum(p_: number[]): number[] { const p = p_.slice(); for (let i=1; i<p.length; i++) { [p[i-1], p[i]] = twoSum(p[i], p[i-1]); } return p; } export { vecSum }