Problems with the sort function!?
Kay Pilz <Kay.Pilz at ruhr-uni-bochum.de> writes:
Hello All. I am running R 2.0.0 with a Win XP operating system. The same problem occured with R 1.9.1 but not with R.1.3.1 on a Win NT computer. My request is about the following problem with the sort function:
...
Taking the difference of the first two entries yields
s[1]-s[2]
[1] -2.220446e-16 which seems to be a numerical artefact. Is this a bug, or just a handling error by me?
You, I think. Consider for instance
x <- c(1.313,1.314,1.315,1.316) diff(x) - 1e-3
[1] 1.118897e-16 -1.101549e-16 1.118897e-16
sort(diff(x) - 1e-3)
[1] -1.101549e-16 1.118897e-16 1.118897e-16
diff(sort(diff(x) - 1e-3)[1:2])
[1] 2.220446e-16
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907