quaeratin
Version:
An extended precision floating point library (as per Shewchuk) - precision only limited by overflow / underflow
23 lines • 778 B
JavaScript
/**
* Returns the result of the given floating point expansion rounded to a double
* floating point number.
*
* The result is within 1 ulps of the actual value, e.g. imagine the worst case
* situation where we add (in 4dot4) 1111.1000 + 0.000011111111... The result
* will be 1111.1000 whereas as the correct result should be 1111.1001 and we
* thus lost 1 ulp of accuracy. It does not matter that the expansion contain
* several floats since none is overlapping.
*
* See Shewchuk https://people.eecs.berkeley.edu/~jrs/papers/robustr.pdf
*
* @param e a floating point expansion
*/
function eEstimate(e) {
let Q = e[0];
for (let i = 1; i < e.length; i++) {
Q += e[i];
}
return Q;
}
export { eEstimate };
//# sourceMappingURL=e-estimate.js.map