
Thanks a lot for the clarification. I just find it very bizarre that if you run a=0.1*(1:9);which(a==0.4) 
it returns the right answer. Anyway, I will pay attention next time. Thanks a lot. 

> Date: Mon, 19 Mar 2012 08:59:59 +0100
> From: Rainer.Schuermann@gmx.net
> Subject: Re: [R] a very simple question
> To: ldjstudy@hotmail.com; r-help@r-project.org
> 
> As to the reasons, David as given you the necessary hints.
> 
> In order to get around the issue, here is what I do:
> 
> > a <- round( 0.1 * ( 1:9 ), 1 )
> > a
> [1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
> > which( a == 0.3 )
> [1] 3
> 
> Rgds,
> Rainer
> 
> 
> -------- Original-Nachricht --------
> > Datum: Sun, 18 Mar 2012 21:43:54 +0000
> > Von: Dajiang Liu <ldjstudy@hotmail.com>
> > An: r-help@r-project.org
> > Betreff: [R] a very simple question
> 
> > 
> > Dear All,
> > I have a seemingly very simple question, but I just cannot figure out the
> > answer. I attempted to run the following:a=0.1*(1:9);which(a==0.3);it
> > returns integer(0). But obviously, the third element of a is equal to 0.3. 
> > I must have missed something. Can someone kindly explain why? Thanks a
> > lot.
> > Regards,Dajiang
> >  		 	   		  
> > 	[[alternative HTML version deleted]]
> > 
> > ______________________________________________
> > 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.
> 
> -- 
> -------
> 
> Gentoo Linux with KDE
> 
 		 	   		  
	[[alternative HTML version deleted]]

