Learn R Programming

cwhmisc (version 2.1)

rec.prot: Protected division

Description

1/x, but 1/0 -> 0

Usage

rec.prot(x, eps = .Machine$double.eps)

Arguments

x
array to invert.
eps
limit: if abs(x) < eps then 1/x -> 0.

Examples

Run this code
rec.prot(c(0,.Machine$double.eps,1.0e-10,1,1.0e100))
  rec.prot(c(0,.Machine$double.eps,1.0e-10,1,1.0e100), 100*.Machine$double.eps)

Run the code above in your browser using DataLab