Displaying 5 results from an estimated 5 matches for "rkahansum".
Did you mean:
kahansum
2019 Feb 19
4
code for sum function
...) {
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
wdunlap tibco.com
On Tue, Feb 19, 2019 at 10:36 AM Paul Gilbert <pgilbert902 at gm...
2019 Feb 20
0
code for sum function
...w-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
> wdunlap tibco.co...
2019 Feb 19
0
code for sum function
...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
> wdunlap tibco.com
&g...
2019 Feb 20
0
code for sum function
...gt; 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
>>
>>
>> B...
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