Learn R Programming

Rmpfr (version 0.4-2)

is.whole: Whole ("Integer") Numbers

Description

Check which elements are integer valued numbers, including MPFR numbers (class mpfr).

Usage

is.whole(x)

Arguments

x
any Rvector

Value

  • logical vector of the same length as x, indicating where x[.] is integer valued.

See Also

is.integer(x) (base package) checks for the internal mode or class; not if x[i] are integer valued.

Examples

Run this code
is.integer(3) # FALSE, it's internally a double
 is.whole(3)   # TRUE
 ## integer valued complex numbers  (two FALSE) :
 is.whole(c(7, 1 + 1i, 1.2, 3.4i, 7i))
 x <- c(as(2,"mpfr") ^ 100, 3, 3.2, 1000000, 2^40)
 is.whole(x) # one FALSE, only

Run the code above in your browser using DataLab