I need to compare numbers. But there are many numerical errors in some comparisons. I know they are errors because analytical results are known. Of course when analytical results are known numerical evaluations are not needed, but I want to know how to resolve these problems numerically. Examples are shown below...
> x <- seq(0,1,length=11)
> x[8]
[1] 0.7
> x[8]==0.7
[1] FALSE
>
> x <- round(seq(1,0,length=21),2)
> x[3]==0.9
[1] TRUE
> x[5]==0.8
[1] TRUE
> (x[3]+x[5])/2
[1] 0.85
> (x[3]+x[5])/2==0.85
[1] FALSE