Exact floating-point accumulator (Kulisch long accumulator). More...
#include <cmath>#include <cstdint>#include <cstring>#include <limits>Go to the source code of this file.
Classes | |
| class | gpr::linalg::ExactSum |
Namespaces | |
| namespace | gpr |
| Gaussian-process regression, kernels, priors, and the searches that run on the surrogate. | |
| namespace | gpr::linalg |
| Dense and structured linear algebra behind the GP: Cholesky and eigen solvers, linear operators, backend selection. | |
Exact floating-point accumulator (Kulisch long accumulator).
Every finite double is an integer multiple of 2^-1074, and the exact product of two finite doubles is an integer multiple of 2^-2148. The accumulator stores that integer over 32-bit digits held in 64-bit limbs. Adding a double or an exact product touches a few limbs and performs no rounding, so the accumulated value is the exact sum of the addends regardless of order. value() rounds the exact sum once to the nearest double (ties to even).
Merging two accumulators, or reducing accumulators across MPI ranks with an integer MPI_SUM, is again exact. A reduction that feeds a decision therefore returns the same bits for every partition of the addends over ranks and threads, provided each addend is itself a deterministic double.
Definition in file ExactSum.h.