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]
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
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
@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