[R] R accuracy

From: Anthony Landrevie <antho_l_at_yahoo.com>
Date: Wed 23 Mar 2005 - 20:03:21 EST


Hello,  

I am trying to test the precision of R on datasets from The Statistical Reference Datasets Project http://www.itl.nist.gov/div898/strd/index.html and I don't manage to understand how R is storing its results.  

For example, I calculate a mean on the michelso dataset (100 values) and find:  

> m=mean(michel)
> m

      V1
299.8524
> print(m,digits=15)

      V1
299.8524

> print(m,digits=22)

                V1 

299.85239999999993  

The certified value of the mean is 299.85240, so I try    

> print(m-299.8524)

           V1
-5.684342e-14  

> print(m-299.8524,digits=15)

                   V1 

-5.68434188608080e-14

Does it have a sens to print with more than 15 signifiant digits? Why is the difference not equal to zero?  

I am using R 2.0.1 under Windows XP.  

Regards,  

Anthony Landrevie                 


        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Mar 23 20:09:16 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:55 EST