Learn R Programming

⚠️There's a newer version (0.7) of this package.Take me there.

PreciseSums (version 0.6)

Accurate Floating Point Sums and Products

Description

Most of the time floating point arithmetic does approximately the right thing. When adding sums or having products of numbers that greatly differ in magnitude, the floating point arithmetic may be incorrect. This package implements the Kahan (1965) sum , Neumaier (1974) sum , pairwise-sum (adapted from 'NumPy', See Castaldo (2008) for a discussion of accuracy), and arbitrary precision sum (adapted from the fsum in 'Python' ; Shewchuk (1997) ). In addition, products are changed to long double precision for accuracy, or changed into a log-sum for accuracy.

Copy Link

Version

Install

install.packages('PreciseSums')

Monthly Downloads

1,324

Version

0.6

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Matthew Fidler

Last Published

April 22nd, 2023

Functions in PreciseSums (0.6)

psSetSum

Choose the type of sums to use for PreciceSums.
pairwiseSum

Return an accurate floating point sum of values
fsum

Return an accurate floating point sum of values
neumaierSum

Using the Neumaier method, take a more accurate sum
psProd

Using PreciceSums's default method, take a product
kahanSum

Using the Kahan method, take a more accurate sum
psSum

Using PreciceSums's default method, take a sum
psSetProd

Choose the type of product to use in PreciceSums. These are used in the PreciceSums prod blocks