Achim Zeileis <[EMAIL PROTECTED]> wrote:
        R> x <- 406.7 + 1e-20 
        R> x
        [1] 406.7
        R> x == 406.7
        [1] TRUE
        
        that is
          1.) `==' comparisons have a certain tolerance

No, all.equal() supports tolerance, == does not.

Consider
        > .Machine$double.eps 
        [1] 2.220446e-16

That is, the smallest relative difference that can be represented on
my (fairly typical IEEE-conforming) machine is 2 in 10 to the 16th.

1e-20/406.7 is 2.458815e-23, which is a factor of 10 million too small
a relative difference for the hardware to be able to represent.  So in

        x <- 406.7 + 1e-20

the value of x is identical to 406.7 in every bit.

        Instead of using `==' you should use a comparison with a certain 
        tolerance you can specify...
        
Such as ?all.equal

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to