Skip to content
Prev 24853 / 398502 Next

%in% not working

On 1 Nov 2002, Peter Dalgaard BSA wrote:

            
Though it's a bit unintuitive that
  1.253 %in% round(seq(1.1, 1.3,by=0.001), 3)
is also FALSE. However,
  round(1.253,3) %in% round( seq(1.1, 1.3, by=0.001), 3)
does work and should be more reliable.

The optimistic version of Peter's general principle is that two real
numbers will compare equal only if they were obtained by the same
computation.


	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._