almost.equal: Test (almost) equality of numeric values

Description Usage Arguments Value Author(s) Examples

Description

The function almost.equal tests if two numeric vectors have equal values up to a tolerance.

Usage

1
almost.equal(x, y, tolerance = sqrt(.Machine$double.eps))

Arguments

x

numeric vector.

y

numeric vector of the same length as x.

tolerance

numeric. Differences smaller than tolerance are considered as equal. The default value is close to 1.5e-8.

Value

A logical vector of the same length as x and y.

Author(s)

Tommy on StackOverflow, see http://stackoverflow.com/a/7667703.

Examples

1
2
almost.equal(x = 1:3, 
             y = 1:3 + c(10^(-6), 10^(-7), 10^(-8)))

bazar documentation built on May 2, 2019, 7:02 a.m.