Re: [R] rounding in calculation

2008-03-21 Thread Prof Brian Ripley
On Fri, 21 Mar 2008, John Lande wrote: > dear all, > > I report a problem very simple, that I does non know how to handle. > > look at the following code: > >> a = rep(16.256, 5) >> sum(a[1:5]^2) - (sum(a[1:5])^2/5) > [1] 2.273737e-13 > > as you can see i retrieve a non 0 value, when i am expected

Re: [R] rounding in calculation

2008-03-21 Thread Gabor Csardi
Read R FAQ 7.31 ? http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f Gabor On Fri, Mar 21, 2008 at 04:17:28PM +0100, John Lande wrote: > dear all, > > I report a problem very simple, that I does non know how to handle. > > look at the following co