uxarray.utils.computing.two_sum#
- uxarray.utils.computing.two_sum(a, b)#
Knuth’s TwoSum: return (s, e) with s = fl(a + b) and s + e = a + b exactly.
Floating-point addition rounds the mathematical result to the nearest representable value.
two_sumcaptures that rounding error in the companion termeso thats + eequals the true sum with no information lost. The cost is four extra floating-point operations beyond the addition itself.