[R] bug when subtracting decimals?
Petr PIKAL
petr.pikal at precheza.cz
Tue Apr 21 10:19:57 CEST 2009
r-help-bounces at r-project.org napsal dne 21.04.2009 10:00:06:
> Petr PIKAL <petr.pikal <at> precheza.cz> writes:
>
> > Maybe that is because of Excel is so widespread now and gives expected
> > results (it probably silently rounds all decimal numbers before
> > calculation).
>
> Marc Schwartz already reminded me of that one, and it's a good point
> to explicitly mention in lectures.
>
> I suggest to extend R by introducing %==% as "being Excellently equal".
It helps but not in all cases
> (0.7-0.3)-.4>0
[1] FALSE
> (0.7-0.3)-.4<0
[1] TRUE
>
There always could be different issues with not exact representation of
decimals. So educated user or internal rounding could help but I am not
sure if later is desired.
Regards
Petr
>
> Dieter
>
> ______________________________________________
> 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