2Sum

2Sum[1] is a floating-point algorithm for computing the exact round-off error in a floating-point addition operation.

2Sum and its variant Fast2Sum were first published by Ole Møller in 1965.

[4] The names 2Sum and Fast2Sum appear to have been applied retroactively by Shewchuk in 1997.

rounded to nearest and the floating-point error

respectively denote the addition and subtraction rounded to nearest.

Provided the floating-point arithmetic is correctly rounded to nearest (with ties resolved any way), as is the default in IEEE 754, and provided the sum does not overflow and, if it underflows, underflows gradually, it can be proven that

[1][6][2] A variant of 2Sum called Fast2Sum uses only three floating-point operations, for floating-point arithmetic in radix 2 or radix 3, under the assumption that the exponent of

:[1][6][7][4] Even if the conditions are not satisfied, 2Sum and Fast2Sum often provide reasonable approximations to the error, i.e.

, which enables algorithms for compensated summation, dot-product, etc., to have low error even if the inputs are not sorted or the rounding mode is unusual.

[1][2] More complicated variants of 2Sum and Fast2Sum also exist for rounding modes other than round-to-nearest.