Check which elements of x[] are integer valued aka “whole” numbers,including MPFR numbers (class '>mpfr).
x[]
'>mpfr
# S3 method for mpfr is.whole(x)
any R vector, here of class '>mpfr.
class
logical vector of the same length as x, indicating where x[.] is integer valued.
x
x[.]
is.integer(x) (base package) checks for the internal mode or class, not if x[i] are integer valued.
is.integer(x)
x[i]
The is.whole() methods in package gmp.
is.whole()
# NOT RUN { is.integer(3) # FALSE, it's internally a double is.whole(3) # TRUE x <- c(as(2,"mpfr") ^ 100, 3, 3.2, 1000000, 2^40) is.whole(x) # one FALSE, only # } # NOT RUN { <!-- %dont --> # }
Run the code above in your browser using DataLab