search for: rnaivesum

Displaying 5 results from an estimated 5 matches for "rnaivesum".

Did you mean: naivesum
2019 Feb 19
4
code for sum function
...;- 0.0 c <- 0.0 # running compensation for lost low-order bits for(xi in x) { y <- xi - c t <- s + y # low-order bits of y may be lost here c <- (t - s) - y s <- t } s } > rSum <- vapply(c(1:20,10^(2:7)), function(n) sum(rep(1/7,n)), 0) > rNaiveSum <- vapply(c(1:20,10^(2:7)), function(n) naiveSum(rep(1/7,n)), 0) > rKahanSum <- vapply(c(1:20,10^(2:7)), function(n) kahanSum(rep(1/7,n)), 0) > > table(rSum == rNaiveSum) FALSE TRUE 21 5 > table(rSum == rKahanSum) FALSE TRUE 3 23 Bill Dunlap TIBCO Software wdun...
2019 Feb 20
0
code for sum function
...low-order bits > for(xi in x) { > y <- xi - c > t <- s + y # low-order bits of y may be lost here > c <- (t - s) - y > s <- t > } > s > } > > > rSum <- vapply(c(1:20,10^(2:7)), function(n) sum(rep(1/7,n)), 0) > > rNaiveSum <- vapply(c(1:20,10^(2:7)), function(n) naiveSum(rep(1/7,n)), > 0) > > rKahanSum <- vapply(c(1:20,10^(2:7)), function(n) kahanSum(rep(1/7,n)), > 0) > > > > table(rSum == rNaiveSum) > > FALSE TRUE > 21 5 > > table(rSum == rKahanSum) > > FALS...
2019 Feb 19
0
code for sum function
...low-order bits > for(xi in x) { > y <- xi - c > t <- s + y # low-order bits of y may be lost here > c <- (t - s) - y > s <- t > } > s > } > >> rSum <- vapply(c(1:20,10^(2:7)), function(n) sum(rep(1/7,n)), 0) >> rNaiveSum <- vapply(c(1:20,10^(2:7)), function(n) naiveSum(rep(1/7,n)), 0) >> rKahanSum <- vapply(c(1:20,10^(2:7)), function(n) kahanSum(rep(1/7,n)), 0) >> >> table(rSum == rNaiveSum) > > FALSE TRUE > 21 5 >> table(rSum == rKahanSum) > > FALSE TRUE >...
2019 Feb 20
0
code for sum function
...t;> y <- xi - c >> t <- s + y # low-order bits of y may be lost here >> c <- (t - s) - y >> s <- t >> } >> s >> } >> >> > rSum <- vapply(c(1:20,10^(2:7)), function(n) sum(rep(1/7,n)), 0) >> > rNaiveSum <- vapply(c(1:20,10^(2:7)), function(n) naiveSum(rep(1/7,n)), >> 0) >> > rKahanSum <- vapply(c(1:20,10^(2:7)), function(n) kahanSum(rep(1/7,n)), >> 0) >> > >> > table(rSum == rNaiveSum) >> >> FALSE TRUE >> 21 5 >> > tab...
2019 Feb 14
5
code for sum function
Hello, I am trying to write FORTRAN code to do the same as some R code I have. I get (small) differences when using the sum function in R. I know there are numerical routines to improve precision, but I have not been able to figure out what algorithm R is using. Does anyone know this? Or where can I find the code for the sum function? Regards, Rampal Etienne