Compute the sum S of all numbers in a binary64 array X along dimension dim with correctly rounded result.
R is the rounding direction (0: towards zero, 0.5: towards nearest and ties to even, +inf: towards positive infinity, -inf: towards negative infinity).
The result is guaranteed to be correctly rounded. That is, the sum is evaluated with (virtually) infinite precision and the exact result is approximated with a binary64 number using the desired rounding direction.
If one element of the sum is NaN or infinities of both signs are encountered, the result will be NaN. An exact zero is returned as +0 in all rounding directions, except for rounding towards negative infinity, where -0 is returned.
A second output parameter yields an approximation of the error. The difference between the exact sum over X and S is approximated by a second binary64 number E with rounding towards zero.
mpfr_vector_sum_d (-inf, [1, eps/2, realmax, -realmax], 2) == 1 ⇒ 1 mpfr_vector_sum_d (+inf, [1, eps/2, realmax, -realmax], 2) == 1 + eps ⇒ 1
See also: sum.
Package: interval