Check IEEE Arithmetic Values

DESCRIPTION:

Returns a logical vector or matrix 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.inf(x) 
is.nan(x) 
is.number(x) 

REQUIRED ARGUMENTS:

x
numeric vector.

VALUE:

Returns an object similar to the input which is filled 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.inf is an abbreviation for is.infinite

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). Spotfire S+ arithmetic and some of its mathematical functions conform to the standard.

SEE ALSO:

, .

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)