Another thing to notice (rather than, it would seem, assume), is that using round() doesn't do any "better":
### without rounding > print(seq(61.55, 61.59, by=.01) , digits=22) [1] 61.549999999999997 61.559999999999995 61.570000000000000 61.579999999999998 [5] 61.589999999999996 ### with rounding > print(round(seq(61.55, 61.59, by=.01),2) , digits=22) [1] 61.549999999999997 61.560000000000002 61.570000000000000 61.579999999999998 [5] 61.590000000000003 As Thomas and Henrik said, the sequence has to be calculated, and such calculations are not, and can not be, exact. -Don At 6:19 PM +0200 4/18/06, [EMAIL PROTECTED] wrote: >Full_Name: Johannes Prix >Version: 2.1.1 >OS: WinXP, SuSE Linux >Submission from: (NULL) (137.208.41.195) > > > >The seq-command produces unnescessary inaccurate results, which can >be extremely >annoying. I absolutely do not see the nescessity of numerical >garbage to appear >in the following simple case. E.g. try this: > >> seq ( 61.55 , 62.00 , by=0.01 ) - round ( seq ( 61.55 , 62.00 , by=0.01 ) , >digits=2 ) > >Output looks like: > > [1] 0.000000e+00 -7.105427e-15 0.000000e+00 0.000000e+00 -7.105427e-15 >-7.105427e-15 0.000000e+00 0.000000e+00 > [9] -7.105427e-15 0.000000e+00 0.000000e+00 0.000000e+00 -7.105427e-15 >0.000000e+00 0.000000e+00 -7.105427e-15 >[17] -7.105427e-15 0.000000e+00 0.000000e+00 -7.105427e-15 0.000000e+00 >0.000000e+00 -7.105427e-15 -7.105427e-15 >[25] 0.000000e+00 0.000000e+00 -7.105427e-15 0.000000e+00 0.000000e+00 >-7.105427e-15 -7.105427e-15 0.000000e+00 >[33] 0.000000e+00 -7.105427e-15 0.000000e+00 0.000000e+00 0.000000e+00 >-7.105427e-15 0.000000e+00 0.000000e+00 >[41] -7.105427e-15 -7.105427e-15 0.000000e+00 0.000000e+00 -7.105427e-15 >0.000000e+00 >> > >It is particularly dangerous to use such seq()-contructed lists (without >rounding) when e.g. trying to find the first time a given number >appears in the >list and the number is given without numerical garbage. > >______________________________________________ >R-devel@r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-devel -- --------------------------------- Don MacQueen Lawrence Livermore National Laboratory Livermore, CA, USA ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel