[R] Odp: seq(...) strange logical value

Petr PIKAL petr.pikal at precheza.cz
Mon Jun 8 15:18:03 CEST 2009


Hi

r-help-bounces at r-project.org napsal dne 08.06.2009 10:45:15:

> 
> Do you heve any idea why I get after this instruction everywhere false?
> > seq (0, 1, by=0.1) == 0.3
>  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> 
> But after different step it's ok:
> > seq(0, 1, by=0.1) == 0.4
>  [1] FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE

Do not use computer, it is known to be imprecise.

See FAQ 7.31 Why doesn't R think these numbers are equal

Regards
Petr


> 
> -- 
> View this message in context: 
http://www.nabble.com/seq%28...%29-strange-
> logical-value-tp23920374p23920374.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list