UNPKG

double-double

Version:

Pure double-double precision functions *with strict error bounds*.

31 lines 896 B
/** * Returns 0 if a === b, a +tive value if a > b or a negative value if a < b. * * @param x a double-double precision floating point number * @param y another double-double precision floating point number */ function ddCompare(x, y) { //return ddDiffDd(x,y)[1]; const xl = x[0]; const xh = x[1]; const yl = y[0]; const yh = y[1]; //const [sl,sh] = twoSum(xh,yh); const sh = xh - yh; const _1 = sh - xh; const sl = (xh - (sh - _1)) + (-yh - _1); //const [tl,th] = twoSum(xl,yl); const th = xl - yl; const _2 = th - xl; const tl = (xl - (th - _2)) + (-yl - _2); const c = sl + th; //const [vl,vh] = fastTwoSum(sh,c) const vh = sh + c; const vl = c - (vh - sh); const w = tl + vl; //const [zl,zh] = fastTwoSum(vh,w) const zh = vh + w; return zh; } export { ddCompare }; //# sourceMappingURL=dd-compare.js.map