📑 Table of Contents

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.[2] Fast2Sum is often used implicitly in other algorithms such as compensated summation algorithms;[1] Kahan's summation algorithm was published first in 1965,[3] and Fast2Sum was later factored out of it by Dekker in 1971 for double-double arithmetic algorithms.[4] The names 2Sum and Fast2Sum appear to have been applied retroactively by Shewchuk in 1997.[5]

Algorithm

edit

Given two floating-point numbers and , 2Sum computes the floating-point sum rounded to nearest and the floating-point error so that , where and respectively denote the addition and subtraction rounded to nearest. The error is itself a floating-point number.

Inputs floating-point numbers
Outputs rounded sum and exact error
  1. return

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 is at least as large as the exponent of , such as when :[1][6][7][4]

Inputs radix-2 or radix-3 floating-point numbers and , where either at least one is zero, or which have normalized exponents
Outputs rounded sum and exact error
  1. return

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 are used for rounding modes other than round-to-nearest.[1]

See also

edit

References

edit
  1. ^ a b c d e f Muller, Jean-Michel; Brunie, Nicolas; de Dinechin, Florent; Jeannerod, Claude-Pierre; Joldes, Mioara; Lefèvre, Vincent; Melquiond, Guillaume; Revol, Nathalie; Torres, Serge (2018). Handbook of Floating-Point Arithmetic (2nd ed.). Cham, Switzerland: Birkhäuser. pp. 104–111. doi:10.1007/978-3-319-76526-6. ISBN 978-3-319-76525-9. Archived from the original on 2023-04-28. Retrieved 2020-09-20.
  2. ^ a b c Møller, Ole (March 1965). "Quasi double-precision in floating point addition". BIT Numerical Mathematics. 5: 37–50. doi:10.1007/BF01975722. S2CID 119991676.
  3. ^ Kahan, W. (January 1965). "Further remarks on reducing truncation errors". Communications of the ACM. 8 (1). Association for Computing Machinery: 40. doi:10.1145/363707.363723. ISSN 0001-0782. S2CID 22584810.
  4. ^ a b Dekker, T.J. (June 1971). "A floating-point technique for extending the available precision". Numerische Mathematik. 18 (3): 224–242. doi:10.1007/BF01397083. S2CID 63218464. Archived from the original on 2020-07-19. Retrieved 2020-09-24.
  5. ^ Shewchuk, Jonathan Richard (October 1997). "Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates". Discrete & Computational Geometry. 18 (3): 305–363. doi:10.1007/PL00009321.
  6. ^ a b Knuth, Donald E. (1998). The Art of Computer Programming, Volume II: Seminumerical Algorithms (3rd ed.). Addison–Wesley. p. 236. ISBN 978-0-201-89684-8. Archived from the original on 2017-07-16. Retrieved 2020-09-20.
  7. ^ Sterbenz, Pat H. (1974). Floating-Point Computation. Englewood Cliffs, NJ, United States: Prentice-Hall. pp. 138–143. ISBN 0-13-322495-3.

📚 Artikel Terkait di Wikipedia

Floating-point error mitigation

result may not be known. The floating-point algorithm known as TwoSum or 2Sum, due to Knuth and Møller, and its simpler, but restricted version FastTwoSum

IEEE 754

prove mathematical properties and design floating-point algorithms such as 2Sum, Fast2Sum and Kahan summation algorithm, e.g. to improve accuracy or implement

SIG Sauer P250

Machine One Serious SIG: SIG P250 Review - Guns And Ammo June 2007 SIG P250 awarded Tactical Handgun of the Year SIG P250 9mm 2SUM Semi-Auto Pistol Package

Catastrophic cancellation

sometimes useful and desirable in numerical algorithms. For example, the 2Sum and Fast2Sum algorithms both rely on such cancellation after a rounding error

Kahan summation algorithm

similar to the Fast2Sum version of Kahan's algorithm with Fast2Sum replaced by 2Sum. For many sequences of numbers, both algorithms agree, but a simple example

Camp Orange

previous seasons, including the first ever New Zealand team (The Awesome 2SUM), and a surprise fifth team (The Flip Sisters). This season teams were: The

Camp Orange (British TV series)

(UK & Ireland). Season 1 premiered on 22 July 2011. The teams were Awesome 2SUM (Caleb and Aled), Double Trouble (Rosie and Rebecca), Yorky Corkies (Georgia

List of numerical analysis topics

summation — slightly worse than Kahan summation but cheaper Binary splitting 2Sum Multiplication: Multiplication algorithm — general discussion, simple methods