[R] Simple addition and subtraction doesn't work??

Erik Iverson iverson at biostat.wisc.edu
Fri Oct 3 23:47:05 CEST 2008


Depending on the class, you might have another teaching opportunity.

See R FAQ 7.31 and the document it points to.

Adrian Teo wrote:
> I was working on a teaching example, but came across this weird result:
> 
>> q<-c(1.6,2.6, -3.4)
>> q
> [1]  1.6  2.6 -3.4
>> sum(q)
> [1] 0.8
>> sum(q)- 0.8
> [1] 2.22044605e-16
> 
> Why is the result not precisely zero?
> 
> Thanks!
> 
> AT
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list