Dear developer, in my version of R (2.4.0) as weel as in a more recent version (2.6.0) on different computers, we found this problem : > a<-(58/40-1) > a [1] 0.45 > b<-(18/40) > b [1] 0.45 > a<b [1] TRUE > a==b [1] FALSE > Something seems wrong here. but if we do > c<-0.45 > d<-0.45 > c<d [1] FALSE then everything is ok. If we use 59 and 19 instead of 58 and 18, the error is not here anymore. I guess there is a problem with the envelop object for the comparisons between different types in R (as in JAVA maybe) but I am not familiar with the R language. I hope this helps, and that this is a real bug, if not, I am sorry to have bothered you. Cheers! Jacques. -- ___________________________________________ Jacques Labonne, Charg? de Recherches UMR ECOBIOP "Ecologie Comportementale et Biologie des Populations de Poissons" P?le d'Hydrobiologie de Saint P?e sur Nivelle, INRA Quartier Ibarron 64310 Saint P?e sur Nivelle T?l : (0)5 59 51 59 80 ................................... site web http://www.st-pee.inra.fr
OMG, not again please! FAQ 7.31. Thanks! On Tue, Feb 12, 2008 at 03:35:09PM +0100, labonne at st-pee.inra.fr wrote:> Dear developer, > > in my version of R (2.4.0) as weel as in a more recent version (2.6.0) > on different computers, we found this problem : > > > a<-(58/40-1) > > a > [1] 0.45 > > b<-(18/40) > > b > [1] 0.45 > > a<b > [1] TRUE > > a==b > [1] FALSE > > > Something seems wrong here. > but if we do > > > c<-0.45 > > d<-0.45 > > c<d > [1] FALSE > > then everything is ok. > If we use 59 and 19 instead of 58 and 18, the error is not here anymore. > I guess there is a problem with the envelop object for the comparisons > between different types in R (as in JAVA maybe) but I am not familiar > with the R language. > I hope this helps, and that this is a real bug, if not, I am sorry to > have bothered you. > > Cheers! > > Jacques. > > > -- > > ___________________________________________ > > Jacques Labonne, Charg? de Recherches > UMR ECOBIOP > "Ecologie Comportementale et Biologie des Populations de Poissons" > P?le d'Hydrobiologie de Saint P?e sur Nivelle, INRA > Quartier Ibarron > 64310 Saint P?e sur Nivelle > T?l : (0)5 59 51 59 80 > ................................... > site web http://www.st-pee.inra.fr > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel-- Csardi Gabor <csardi at rmki.kfki.hu> UNIL DGM
On 2/12/2008 9:35 AM, labonne at st-pee.inra.fr wrote:> Dear developer, > > in my version of R (2.4.0) as weel as in a more recent version (2.6.0) > on different computers, we found this problem :This is not a bug, it's a limitation of finite precision arithmetic, and it's FAQ 7.31. Duncan Murdoch> > > a<-(58/40-1) > > a > [1] 0.45 > > b<-(18/40) > > b > [1] 0.45 > > a<b > [1] TRUE > > a==b > [1] FALSE > > > Something seems wrong here. > but if we do > > > c<-0.45 > > d<-0.45 > > c<d > [1] FALSE > > then everything is ok. > If we use 59 and 19 instead of 58 and 18, the error is not here anymore. > I guess there is a problem with the envelop object for the comparisons > between different types in R (as in JAVA maybe) but I am not familiar > with the R language. > I hope this helps, and that this is a real bug, if not, I am sorry to > have bothered you. > > Cheers! > > Jacques. > >
On Tue, 2008-02-12 at 15:35 +0100, labonne at st-pee.inra.fr wrote:> Dear developer, > > in my version of R (2.4.0) as weel as in a more recent version (2.6.0) > on different computers, we found this problem :No problem in R. This is the FAQ of all FAQs (Type III SS is probably up there as well). See the R FAQ, 7.31, for further information: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f For your example:> all.equal(a, b)[1] TRUE <snip />> I hope this helps, and that this is a real bug, if not, I am sorry to > have bothered you.In future - if you aren't sure that you have found a bug in R, and you've done your home work (as per the Posting Guide), post a comment/question on the R Devel list. You'd have gotten the same response (not a bug, read R FAQ 7.31) but you wouldn't have created additional work for one the the R Core Development Team who will now have to deal with your bug report in the R bug tracker. HTH G> > Cheers! > > Jacques. > >-- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
On Tue, 12 Feb 2008 15:47:56 +0100 Gabor Csardi <csardi at rmki.kfki.hu> wrote:> OMG, not again please! > > FAQ 7.31.Yeah, there seems to be a cluster of that type of questions at the moment. Perhaps it is time to introduce a global option "HaveReadFAQ7.31" whose default is "FALSE" but can be changed via the normal mechanism to "TRUE". Any comparison of numeric values/vectors should print a warning message "You are comparing numbers calculated using finite precision arithmetic, have you read FAQ 7.31." while the value of this option is FALSE. Perhaps that will help. :) Cheers, Berwin =========================== Full address ============================Berwin A Turlach Tel.: +65 6516 4416 (secr) Dept of Statistics and Applied Probability +65 6516 6650 (self) Faculty of Science FAX : +65 6872 3919 National University of Singapore 6 Science Drive 2, Blk S16, Level 7 e-mail: statba at nus.edu.sg Singapore 117546 http://www.stat.nus.edu.sg/~statba