[R] Funky calculations

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Tue Feb 1 17:35:57 CET 2022


On Tue, 1 Feb 2022 20:45:40 +0700
Nathan Boeger <nboeger using gmail.com> wrote:

> I found something strange and maybe I am going nuts but this does not
> make sense:
> 
> >  (0.4 + 0.2 + 0 + 0.3 + 0 + 0.1) > 1  
> [1] TRUE

Unfortunately, this always happens when computers approximate real
numbers with fractions in binary. See R FAQ 7.31 (RShowDoc('FAQ') or
<https://cran.r-project.org/doc/FAQ/R-FAQ.html>).

-- 
Best regards,
Ivan



More information about the R-help mailing list