> Note however the result of > > 0.1*(5:0) == 0.3) > [1] FALSE FALSE FALSE FALSE FALSE FALSE > > as opposed to "==0.5", "==0.4", "==0.2", "==0.1" or "==0"! > > I hope this helps, > Ted. > > > -------------------------------------------------------------------- > E-Mail: (Ted Harding) <[EMAIL PROTECTED]> > Fax-to-email: +44 (0)870 167 1972 > Date: 03-Sep-04 Time: 13:59:59
At the risk of flailing at a dead and even dessicated horse ... >From the Help file of identical(), the construction identical(all.equal(x,y),TRUE) gives the desired test for equality for finite precision arithmetic. Hence: > sapply(.1*(0:5),function(x)identical(all.equal(x,.3),TRUE)) [1] FALSE FALSE FALSE TRUE FALSE FALSE which is, presumably, as desired. Cheers, -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA "The business of the statistician is to catalyze the scientific learning process." - George E. P. Box
______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
