It is for the same reason that if you must work with numbers stored with 2 significant decimal digits 1-(1/3+1/3+1/3) is 0.01 (== 10 ^ -2).
Double precision numbers, supported by your computer hardware and used by R, are stored using 52 significant binary digits and 2^-52 is about -2.220446e-16. (By the way, in R zero and NULL are different things: the former is numeric and the latter is not.) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of ollestrat > Sent: Tuesday, July 10, 2012 1:17 PM > To: r-help@r-project.org > Subject: [R] -1.1 - 0.1 + 1.2 is NOT null! Why? > > Hello, > > I fear its a stupid question,..but here it is: > > If I do this simple calculation with the R console, I surprisingly do not > get a zero. Why? > > -1.1-0.1+1.2 > [1] -2.220446e-16 > > > greetings, Ole > > -- > View this message in context: > http://r.789695.n4.nabble.com/1-1-0-1-1-2-is-NOT- > null-Why-tp4636053.html > Sent from the R help mailing list archive at Nabble.com. > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.