Exactly Rounded Sums, Means and Dot Products
Overview
Sums of double-precision numbers computed exactly and rounded once, so the result is the correctly rounded true sum and does not depend on the order of the elements, the platform, or whether R was built with long doubles. Built on the small and large superaccumulators of Neal (2015) doi:10.48550/arXiv.1505.05571. Provides exactly rounded sums, means, cumulative sums, dot products and norms, row, column and grouped sums, accumulators that can be built in pieces and merged across processes, and a registered 'C' interface for other packages.
First release.
- Vendors Radford Neal's 'xsum' (stable version 3), patched so that no standard I/O reaches the compiled code; upstream's checker and fuzzer run against the vendored copy in CI.
- A vignette,
vignette("exact-summation"), explains why basesum()differs between platforms and how to sum in pieces and from C. xsum()returns the exactly rounded sum of double, integer, logical and complex vectors, withna.rm, applying the same special-value rules on every platform. ALTREP vectors are read in blocks, never materialised.zuexact_info()reports the vendored 'xsum' version, the accumulator threshold, SIMD and FMA support, and whether R has long doubles.xsum_mean()divides the exact sum by the count with one rounding;xsum_weighted_mean()divides two exact sums.
Show all changes in 0.1.0Hide the rest of the changes in 0.1.0
xsum_dot(),xsum_sqnorm()andxsum_norm()include each product's rounding error (TwoProduct withfma()), so dot products are exactly rounded too.xsum_cumsum()rounds every prefix sum exactly.- Accumulators as R values:
xsum_acc(),xsum_add(),xsum_merge(),xsum_negate(),xsum_value()andxsum_mean_value()build exact sums in pieces, in any order, and across processes (they serialise). xsum_rowsums(),xsum_colsums()andxsum_by()are exact versions ofrowSums(),colSums()androwsum(). Row sums work a block of rows at a time, so their extra memory does not grow with the number of rows.- A registered C interface,
zuexact_api_v1ininst/include/zuexact.h, gives other packages' C code the same exact accumulators, sums, dot products, merges and means, throughLinkingTo: zuexact. - Every result is tested against exact rational arithmetic ('gmp'),
PreciseSums::fsum(), the test262Math.sumPrecisevectors and ill-conditioned inputs up to condition number 1e40, and must be bit-identical on every CI platform.
From NEWS.md in the release
Install
Health
- OK10 OKNow
- OK6 OK2026-10-23
Documentation
- Help pages
- 9 (1 internal)includes a package overview page
- Examples that run
- 100%8 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 80%
- Return-value docs
- 100%
- Help pages citing references
- 0%
- Exact summation HTML
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- 0
- Median days to close, 50 most recently updated closed PRs
- 0
Repository github.com/pedrobtz/zuexact is linked, but repository-practices checks have not run for it yet.
Dependencies
Installing zuexact adds no packages beyond those that come with R.
Code & Tests
People & History
- 0.1.0Latest2026-10-22 · current release ·
8 days in CRAN's queue
Listed in CRAN's incoming queue from 2026-10-14 00:46 to 2026-10-22 06:53 UTC, in 50 readings. - RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-10-22
- Total releases
- 1 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1
- Download size
- 82 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("zuexact")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.