Zitat von Barry Rowlingson <[EMAIL PROTECTED]>:
> Peter Flom wrote:
> > I tried your sample code, and a few other variations, and
> got 0 for all
> > of them, running R 1.8.1 on a Windows machine
>
> Not only do I get 0 on R 1.8.1 on Unix (linux, RH8), I get
> _exactly_
> 0. I thought this was going to be a simple arithmetic
> precision problem,
> but this test script shows the answers to be exactly zero:
>
> zertest <- function(q){
> if( q != 0 ){
> theCall <- deparse(substitute(q))
> cat(paste("failed",theCall,' : got ',q,'\n',sep=' '))
> }
> }
>
> # these fail, as expected:
> zertest(sd(c(1,2,3)))
> zertest(sd(c(rep(0.01,12),0.00000001)))
>
> # these pass as zero:
> zertest(sd(rep(0.01, 13))) #1.805557e-18
This doesnt pass as zero:
> zertest(sd(rep(0.01, 13)))
failed sd(rep(0.01, 13)) : got 1.80555743920831e-18
I use Unix-Version Sun OS 5.9. I didnt compile it myself. Could
compiler/config problems have caused this?
> zertest(sd(rep(0.001, 13))) #4.513894e-19
This doesnt pass, either.
> zertest(sd(rep(0.00001, 13))) #0
> zertest(sd(rep(0.00000001,13))) #0
>
> Might be a compiler/config funny. Andreas: what 'UNIX' is
> this? Did
> you compile R yourself? Did you run 'make check'?
>
> Baz
>
>
>
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html