Learn R Programming

bazar (version 1.0.11)

almost.equal: 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.

Examples

Run this code
# NOT RUN {
almost.equal(x = 1:3, 
             y = 1:3 + c(10^(-6), 10^(-7), 10^(-8)))

# }

Run the code above in your browser using DataLab