The help page for ?is.integer has a note about a function that will tell us if a value is an integer:
is.wholenumber <-
function(x, tol = .Machine$double.eps^0.5) abs(x - round(x)) < tol
What could be the argument to use sqrt(eps) as tolerance here? Also, is there a good reason to use anything else than tol=0?
The background is my answer on this question. Some commenters objected to this function.
My simple minded hypothesis: this is done to make it close in behavior to print (which has a default of 7 decimal digits). E.g.:
> 1.000005
[1] 1.000005
> 1.0000000005
[1] 1
> is.wholenumber(1.000005)
[1] FALSE
> is.wholenumber(1.0000000005)
[1] TRUE
It does not work perfectly though:
> 1.00000005
[1] 1
> is.wholenumber(1.00000005)
[1] FALSE
There is a better argument in the comments below: the sqrt(eps) may be a (rough) estimate of the round-off error caused by floating-point operations.