Skip to contents

zuexact 0.1.0

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 base sum() 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, with na.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.

  • xsum_dot(), xsum_sqnorm() and xsum_norm() include each product’s rounding error (TwoProduct with fma()), 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() and xsum_mean_value() build exact sums in pieces, in any order, and across processes (they serialise).

  • xsum_rowsums(), xsum_colsums() and xsum_by() are exact versions of rowSums(), colSums() and rowsum(). 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_v1 in inst/include/zuexact.h, gives other packages’ C code the same exact accumulators, sums, dot products, merges and means, through LinkingTo: zuexact.

  • Every result is tested against exact rational arithmetic (‘gmp’), PreciseSums::fsum(), the test262 Math.sumPrecise vectors and ill-conditioned inputs up to condition number 1e40, and must be bit-identical on every CI platform.