UNPKG

double-double

Version:

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

18 lines (13 loc) 403 B
/** * Returns the exact result of subtracting b from a. * * @param a minuend - a double-double precision floating point number * @param b subtrahend - a double-double precision floating point number */ function twoDiff(a: number, b: number) { const x = a - b; const bvirt = a - x; const y = (a - (x + bvirt)) + (bvirt - b); return [y, x]; } export { twoDiff }