[R] seq(0.05,0.95,by=0.002) and logical error

Álvaro A. Novo novo at uiuc.edu
Sun Dec 10 06:25:13 CET 2000


Regardless of which version -- 1.1.1 or 1.2.0 (2000-11-27) -- with a fresh 
"directory" (i.e. no .RData), I am getting an extremely weird result. 

R : Copyright 2000, The R Development Core Team
Version 1.2.0 Under development (unstable) (2000-11-27)

> jj _ seq(0.05,0.95,by=0.002)
> sum(jj==0.75) ## WRONG ANSWER
[1] 0
> 0.05 + 350*.002 ## Double check that 0.75 is in jj
[1] 0.75
> sum(jj==0.5)
[1] 1
> sum(jj==0.562)
[1] 1
> sum(jj==0.564) ## 0.564 seems to be the cutoff point
[1] 0

Version 1.1.1  (August 15, 2000)

> jj _ seq(0.05,0.95,by=0.002)
> sum(jj==0.75)  ## WRONG ANSWER
[1] 0
> sum(jj==0.562)
[1] 1
> sum(jj==0.564)
[1] 0

An additional note, for a different sequence, 0.75 is "recognized"...

> jj _ seq(0,0.95,by=0.002)
> sum(jj==0.75) 
[1] 1


Thank you for your attention,

Alvaro Novo
Linux 2.2.17 - SuSE 6.4

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list