Check IEEE Arithmetic Values

DESCRIPTION:
Returns a logical vector describing the type of numeric elements present. This distinguishes between infinite values, NaN's, missing values and ordinary numbers.

USAGE:
is.finite(x)
is.infinite(x)
is.nan(x)
is.number(x)

REQUIRED ARGUMENTS:
x:
numeric vector.

VALUE:
a vector of logical values. Values will be false for vectors that are not of mode "numeric".

is.finite is TRUE for values of x that are specific non-infinite numbers (that is, not NA and not infinite).

is.infinite is TRUE for values of x that are either plus or minus infinity.

is.nan is only TRUE for values that are "Not a Number". These are values that were created by an undefined numerical operation, such as 0/0 or Inf-Inf and they are printed as NA.

is.number is TRUE if the value is finite or infinite, i.e., is neither missing (NA) nor not-a-number (NaN).


DETAILS:
In previous versions of S-PLUS, values that were "Not a Number" were printed as NaN; they are now printed as NA. The is.nan (and which.nan) function is the only way to distinguish between values that are "Not a Number" and values that are truly missing.

BACKGROUND:
These functions are useful only on machines that support the IEEE arithmetic standard (the VAX is not such a machine). S-PLUS arithmetic and some of its mathematical functions conform to the standard.

SEE ALSO:
is.na , Arithmetic .

EXAMPLES:
# a non-zero number divided by zero creates infinity
# zero over zero creates a NaN
weird.values <- c(1/0, -20.9/0, 0/0, NA)

is.infinite(weird.values)

is.nan(weird.values) is.na(weird.values)