neumaierSum: Using the Neumaier method, take a more accurate sum

Description Usage Arguments Value References Examples

View source: R/sums.R

Description

Using the Neumaier method, take a more accurate sum

Usage

1
neumaierSum(numbers)

Arguments

numbers

A vector of numbers to sum.

Value

Sum of numbers, a bit more accurate than kahanSum

References

https://en.wikipedia.org/wiki/Kahan_summation_algorithm

Examples

1
2
sum(c(1,1e100,1,-1e100)) ## Should be 2, gives 0
neumaierSum(c(1,1e100,1,-1e100)) ## Gives 2

Example output

[1] 0
[1] 2

PreciseSums documentation built on July 10, 2020, 5:13 p.m.