Search code examples
epsilon

why use square root of epsilon as the small number


This question may be independent of the language, but I saw this post using R mentions using square root of epsilon as the small number:

is.wholenumber <-
    function(x, tol = .Machine$double.eps^0.5)  abs(x - round(x)) < tol

Why there's a square root ^0.5? Any help's appreciated.


Solution

  • This is not really an R specific question. However, this post provides some answers to your question. Basically, it is a good rule of thumb to avoid loss of precision.