[R] scan seems to modify the data

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Mar 31 20:02:48 CEST 2004


Duncan Murdoch <dmurdoch at pair.com> writes:

> > print(x,17)
> [1] 0.26600000000000001 0.25100000000000000
...
> > print(x,17)
> [1] 0.266
> 
> I don't know why the second print() prints 0.266 differently from the
> first one.  (This is in the 1.9.0 beta in Windows).

To get the same number of decimals as the other guy. The interesting
question is why 0.251 gets all those trailing zeros:

> print(0.251,17)
[1] 0.25100000000000000
> print(0.253,17)
[1] 0.25300000000000000
> print(0.255,17)
[1] 0.255


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list