[R] Odp: calculate differences - strange outcome

Petr PIKAL petr.pikal at precheza.cz
Thu Jul 17 12:18:42 CEST 2008


Hi

r-help-bounces at r-project.org napsal dne 17.07.2008 11:47:42:

> Dear List,
> 
> I ran into some trouble by calculating differences. For me it is
> important that differences are either 0 or not.

So you shall not use computers. They do not work with infinite precision.
See Faq 7.31

Regards
Petr

> 
> So I don't understand the outcome of this calculation
> 
> 865.56-(782.86+0+63.85+18.85+0)
> [1] -1.136868e-13
> 
> I run R version 2.71 on WinXP
> 
> I could solve my problem by using
> round()
> but I would like to know the reason.
> Maybe someone can help me?
> 
> Thanx
> 
> ______________________________________________
> 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