UNPKG

quaeratin

Version:

An extended precision floating point library (as per Shewchuk) - precision only limited by overflow / underflow

18 lines (13 loc) 301 B
/** * Returns the exact result of subtracting b from a (as a floating point * expansion). * @param a * @param b */ 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 }