[R] strange behaviour with equality after simple subtraction

2007-01-26 Thread martin sikora
hello, today while trying to extract data from a list for subsequent analysis, i stumbled upon this funny behavior on my system: x-c(0.1,0.9) 1-x[2] [1] 0.1 x[1] [1] 0.1 x[1]==1-x[2] [1] FALSE x[1]1-x[2] [1] TRUE x-c(0.3,0.7) x[1] [1] 0.3 x[2] [1] 0.7 1-x[2] [1]

Re: [R] strange behaviour with equality after simple subtraction

2007-01-26 Thread Mike Prager
martin sikora [EMAIL PROTECTED] wrote: today while trying to extract data from a list for subsequent analysis, i stumbled upon this funny behavior on my system: x-c(0.1,0.9) 1-x[2] [1] 0.1 x[1] [1] 0.1 x[1]==1-x[2] [1] FALSE x[1]1-x[2] [1] TRUE Not at all

Re: [R] strange behaviour with equality after simple subtraction

2007-01-26 Thread Benilton Carvalho
In addition to Mike's comment: x-c(0.1,0.9) 1-x[2] [1] 0.1 x[1]==1-x[2] [1] FALSE all.equal(x[1], 1-x[2]) [1] TRUE b On Jan 26, 2007, at 11:40 AM, Mike Prager wrote: Not at all strange, an expected property of floating-point arithmetic and one of the most frequently asked questions

Re: [R] strange behaviour with equality after simple subtraction

2007-01-26 Thread Bert Gunter
@stat.math.ethz.ch Subject: Re: [R] strange behaviour with equality after simple subtraction martin sikora [EMAIL PROTECTED] wrote: today while trying to extract data from a list for subsequent analysis, i stumbled upon this funny behavior on my system: x-c(0.1,0.9) 1-x[2] [1] 0.1 x[1