quaeratin
Version:
An extended precision floating point library (as per Shewchuk) - precision only limited by overflow / underflow
20 lines • 734 B
JavaScript
import { eDiff } from "./e-diff.js";
import { eSign } from "./e-sign.js";
/**
* Returns 0 if a === b, a +tive value if a > b or a negative value if a < b.
*
* * see [Shewchuk](https://people.eecs.berkeley.edu/~jrs/papers/robustr.pdf)
*
* "The easiest way to compare two expansions is to subtract one from the other,
* and test the sign of the result. An expansion’s sign can be easily tested
* because of the nonoverlapping property; simply check the sign of the
* expansion's most significant nonzero component..."
*
* @param a a floating point expansion
* @param b another floating point expansion
*/
function eCompare(a, b) {
return eSign(eDiff(a, b));
}
export { eCompare };
//# sourceMappingURL=e-compare.js.map