[Rd] incorrect result (41/10-1/10)%%1 (PR#13863)

Petr Savicky savicky at cs.cas.cz
Mon Aug 3 11:50:01 CEST 2009


> I get an incorrect result for
> 
> (41/10-1/10)%%1
> 
> [1] 1

Note that due to rounding errors, 41/10-1/10 is
  formatC(41/10-1/10, digits=20) # [1] "3.9999999999999995559"

Besides FAQ 7.31, related information may be found also at
  http://wiki.r-project.org/rwiki/doku.php?id=misc:r_accuracy

Petr.



More information about the R-devel mailing list