Re: [Rd] BUG in " == " ? (PR#9065)

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Fri 07 Jul 2006 - 09:59:04 GMT

eric.durand@imag.fr writes:

> Hello,
> here is the version of R that I use :
>
> > version
> _
> platform i486-pc-linux-gnu
> arch i486
> os linux-gnu
> system i486, linux-gnu
> status
> major 2
> minor 3.1
> year 2006
> month 06
> day 01
> svn rev 38247
> language R
> version.string Version 2.3.1 (2006-06-01)
>
> And here is one of the sequences of isntruction that returns an abberation :
>
> > x<-seq(0,1,by=0.01)
> > x[71]

> [1] 0.7
> > which(x == 0.7)

> numeric(0)
> > x[71] == 0.7

> [1] FALSE
>
> Or another version of (maybe) the same bug :
>
> > x <- 70
> > x == 70
> [1] TRUE
> > x <- x*0
> > x <- 70
> > x == 70
> [1] TRUE
> > x<-x*0.01
> > x

> [1] 0.7
> > x == 0.7
> [1] FALSE
>
> It seems completely strange ... any help would be greatly appreciated :)

FAQ 7.31 http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f

-- 
   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri Jul 07 20:04:04 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 07 Jul 2006 - 12:27:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.