This is a FAQ:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f
and also covered nicely in Burns' R Inferno:
www.burns-stat.com/pages/Tutor/R_inferno.pdf

Sarah

On Wed, Mar 18, 2009 at 11:58 AM, Yu, Changhong <y...@ccf.org> wrote:
> Dear all,
>
>
>
> I am totally confused by the following R output, but don't have a clue
> for it.
>
>
>
>> a <- 1 - 0.2
>
>> a == 0.8
>
> [1] TRUE
>
>> a <- 1 - 0.8
>
>> a == 0.2
>
> [1] FALSE
>
>> a <- 1 - 0.5
>
>> a == 0.5
>
> [1] TRUE
>
>> a <- 1 - 0.6
>
>> a == 0.4
>
> [1] TRUE
>
>> a <- 1 - 0.9
>
>> a == 0.1
>
> [1] FALSE
>
>
>
>
>
> My R version is Windows XP R version 2.8.1 (2008-12-22).
>
>
>
> Thanks very much.
>
>
>
>
>
> Changhong
>
>

-- 
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
R-help@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.

Reply via email to