almost.equal {bazar}R Documentation

Test (almost) equality of numeric values

Description

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

Usage

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

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


[Package bazar version 1.0.11 Index]