[R] Simple addition and subtraction doesn't work??
Uwe Ligges
ligges at statistik.tu-dortmund.de
Sat Oct 4 11:42:37 CEST 2008
Erik Iverson wrote:
> Depending on the class, you might have another teaching opportunity.
.... right away after showing your students that (and why) x + 1 - x = 0
Example:
x <- 10^20
x + 1 - x
Uwe Ligges
>
> 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.
>
> ______________________________________________
> 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