[go: up one dir, main page]

Function accurate::two_sum [] [src]

pub fn two_sum<F>(a: F, b: F) -> (F, F) where F: Float

Sum transformation

Transforms a sum a + b into the pair (x, y) where

x = fl(a + b)

is the sum of a and b with floating point rounding applied and

y = a + b - x

is the remainder of the addition.

References

From Knuth's AoCP, Volume 2: Seminumerical Algorithms