For differentiating NA from NaN currently behavior of test function is consistent to all.equal while more appropriate IMO would be to expect identical behavior.
all.equal(NaN, NA_real_)
#[1] TRUE
identical(NaN, NA_real_)
#[1] FALSE
Unfortunately it is not that simple, we would need to overwrite all.equal.numeric to retain current features that comes from all.equal and be able to differentiate NA from NaN.
This ideally should be fixed upstream in R giving an option to differentiate both.
For differentiating
NAfromNaNcurrently behavior oftestfunction is consistent toall.equalwhile more appropriate IMO would be to expectidenticalbehavior.Unfortunately it is not that simple, we would need to overwrite
all.equal.numericto retain current features that comes fromall.equaland be able to differentiate NA from NaN.This ideally should be fixed upstream in R giving an option to differentiate both.