ITADN

all.equal.data.table throws "Dataset 'current' has rows not present in 'target'" when double precision values are numerically, but not exactly, equal

#7816Openkjellpk 创建于 2026-07-15
K
kjellpkcommented
When `ignore.row.order = TRUE`, `all.equal.data.table` throws' "Dataset 'current' has rows not present in 'target'" when there are multiple double precision columns and any but the last one are not perfectly equal. ```{r} > library(data.table) data.table 1.18.4 using 5 threads (see ?getDTthreads). Latest news: r-datatable.com Attaching package: ‘data.table’ The following object is masked from ‘package:base’: %notin% > eps <- sqrt(.Machine$double.eps) / 3.0 > > x <- data.table(a = "a", ione = 1L, done = 1.0, dtwo = 2.0) > y <- copy(x) > y[, done := done - eps] > all.equal(x, y, ignore.row.order = TRUE) [1] "Dataset 'current' has rows not present in 'target'" ```
2 条评论