[R] -1.1 - 0.1 + 1.2 is NOT null! Why?
wdunlap at tibco.com
Tue Jul 10 23:08:08 CEST 2012
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.)
Spotfire, TIBCO Software
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
> Behalf Of ollestrat
> Sent: Tuesday, July 10, 2012 1:17 PM
> To: r-help at r-project.org
> Subject: [R] -1.1 - 0.1 + 1.2 is NOT null! Why?
> 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?
>  -2.220446e-16
> greetings, Ole
> View this message in context: http://r.789695.n4.nabble.com/1-1-0-1-1-2-is-NOT-
> Sent from the R help mailing list archive at Nabble.com.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help