floating point issue in R? [duplicate]

There are R functions that automatically take sensible approaches to the “equality problem”:

> (3 - 2.9) <=0.1
#[1] FALSE

> all.equal( (3 - 2.9) , 0.1)
#[1] TRUE

It uses the sqrt of R’s smallest positive floating point number as its default threshold, so it handles multiplications and division propagated errors. Ends up being around 1e-08

Leave a Comment