How can I test if the square root of a number is an integer using R?
The following all evaluate to FALSE
.
is.integer( sqrt(25) )
is.integer( sqrt(25L) )
How can I test if the square root of a number is an integer using R?
The following all evaluate to FALSE
.
is.integer( sqrt(25) )
is.integer( sqrt(25L) )
Ok, I found a work around, but I'm not sure if it's efficient or even robust to using more exotic numbers.
Evaluates to
TRUE
.Perhaps a better way of doing this would be:
Which also evaluates to
TRUE
. Adapted from this answer.