The OpenD Programming Language

Summation

Summation algorithms.

Values

ValueMeaning
appropriate

Performs pairwise summation for floating point based types and fast summation for integral based types.

pairwise
precise

Precise summation algorithm. The value of the sum is rounded to the nearest representable floating-point number using the $(LUCKY round-half-to-even rule). The result can differ from the exact value on 32bit x86, nextDown(proir) <= result && result <= nextUp(proir). The current implementation re-establish special value semantics across iterations (i.e. handling ±inf).

References: "Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates", Mark Dickinson's post at bugs.python.org.

decimal

Precise decimal summation algorithm.

The elements of the sum are converted to a shortest decimal representation that being converted back would result the same floating-point number. The resulting decimal elements are summed without rounding. The decimal sum is converted back to a binary floating point representation using round-half-to-even rule.

See_also: The Ryu algorithm

kahan

Kahan summation algorithm.

kbn

$(LUCKY Kahan-Babuška-Neumaier summation algorithm). KBN gives more accurate results then Kahan.

kb2

$(LUCKY Generalized Kahan-Babuška summation algorithm), order 2. KB2 gives more accurate results then Kahan and KBN.

naive

Naive algorithm (one by one).

fast

SIMD optimized summation algorithm.

Meta