Skip to content
Prev 58549 / 63421 Next

Precision of function mean,bug?

On Wed, May 20, 2020 at 11:10 AM brodie gaslam via R-devel
<r-devel at r-project.org> wrote:
This one is important.

FWIW, matrixStats::mean2() provides argument refine=TRUE/FALSE to
calculate mean with and without this two-pass calculation;
[1] FALSE
[1] 2.220446e-16
[1] TRUE
[1] 0
[1] TRUE
[1] 0
[1] FALSE
[1] 2.220446e-16

Not surprisingly, the two-pass higher-precision version (refine=TRUE)
takes roughly twice as long as the one-pass quick version
(refine=FALSE).

/Henrik