A utility to compare integer64 objects 'x' and 'y' testing for ‘near equality’, see all.equal
.
# 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
)
Either ‘TRUE’ (‘NULL’ for ‘attr.all.equal’) or a vector of ‘mode’ ‘"character"’ describing the differences between ‘target’ and ‘current’.
a vector of 'integer64' or an object that can be coerced with as.integer64
a vector of 'integer64' or an object that can be coerced with as.integer64
numeric \(\ge\) 0. Differences smaller than
tolerance
are not reported. The default value is close to
1.5e-8
.
NULL
or numeric > 0, typically of length 1 or
length(target)
. See ‘Details’.
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.
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
logical indicating if the
attributes
of target
and current
(other than the names) should be compared.
Leonardo Silvestri (for package nanotime)
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
.
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