Full_Name: Chris Spencer
Version: 2.0.1
OS: Linux
Submission from: (NULL) (163.1.211.93)


Dear R team,

I realise that the following is a bit unsafe (the combination of doubles and
integers), however I wondered whether the following behaviour is expected: 

> #Test R
> test <- vector(length=100000);
> for(i in 1:100000){temp = i/1000; test[i] = (i == temp*1000);}
> table(test);
test
FALSE  TRUE
 1472 98528

For example I can also make the following error:

>  as.integer(259.765*1000);
[1] 259765
>  as.integer(259.763*1000);
[1] 259762

Would you expect this to be the case and if so why?
Thanks for your help.

Chris Spencer

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to