kahanSum

0th

Percentile

Using the Kahan method, take a more accurate sum

Using the Kahan method, take a more accurate sum

Usage
kahanSum(numbers)
Arguments
numbers

A vector of numbers to sum.

Value

Sum of numbers

References

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

Aliases
  • kahanSum
Examples
# NOT RUN {
sum(c(1,1e100,1,-1e100)) ## Should be 2, gives 0
kahanSum(c(1,1e100,1,-1e100)) ## Not accurate enough for the correct result. (still = 0)
# }
Documentation reproduced from package PreciseSums, version 0.3, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.