Learn R Programming

bit64 (version 4.5.2)

all.equal.integer64: Test if two integer64 vectors are all.equal

Description

A utility to compare integer64 objects 'x' and 'y' testing for ‘near equality’, see all.equal.

Usage

# S3 method for integer64
all.equal(
  target
, current
, tolerance = sqrt(.Machine$double.eps)
, scale = NULL
, countEQ = FALSE
, formatFUN = function(err, what) format(err)
, ...
, check.attributes = TRUE
)

Value

Either ‘TRUE’ (‘NULL’ for ‘attr.all.equal’) or a vector of ‘mode’ ‘"character"’ describing the differences between ‘target’ and ‘current’.

Arguments

target

a vector of 'integer64' or an object that can be coerced with as.integer64

current

a vector of 'integer64' or an object that can be coerced with as.integer64

tolerance

numeric \(\ge\) 0. Differences smaller than tolerance are not reported. The default value is close to 1.5e-8.

scale

NULL or numeric > 0, typically of length 1 or length(target). See ‘Details’.

countEQ

logical indicating if the target == current cases should be counted when computing the mean (absolute or relative) differences. The default, FALSE may seem misleading in cases where target and current only differ in a few places; see the extensive example.

formatFUN

a function of two arguments, err, the relative, absolute or scaled error, and what, a character string indicating the kind of error; maybe used, e.g., to format relative and absolute errors differently.

...

further arguments are ignored

check.attributes

logical indicating if the attributes of target and current (other than the names) should be compared.

Author

Leonardo Silvestri (for package nanotime)

Details

In all.equal.numeric the type integer is treated as a proper subset of double i.e. does not complain about comparing integer with double. Following this logic all.equal.integer64 treats integer as a proper subset of integer64 and does not complain about comparing integer with integer64. double also compares without warning as long as the values are within lim.integer64, if double are bigger all.equal.integer64 complains about the all.equal.integer64 overflow warning. For further details see all.equal.

See Also

Examples

Run this code
  all.equal(as.integer64(1:10), as.integer64(0:9))
  all.equal(as.integer64(1:10), as.integer(1:10))
  all.equal(as.integer64(1:10), as.double(1:10))
  all.equal(as.integer64(1), as.double(1e300))

Run the code above in your browser using DataLab