[R] Odp: calculate differences - strange outcome

From: Petr PIKAL <petr.pikal_at_precheza.cz>
Date: Thu, 17 Jul 2008 12:18:42 +0200

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.



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. Received on Thu 17 Jul 2008 - 10:29:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 17 Jul 2008 - 10:31:50 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive