xxxx <- c(100,-1e-13,Inf,-Inf, NaN, pi, NA)
names(xxxx) <- formatC(xxxx, dig=3)
(aaaa <- outer(xxxx,xxxx,function(x,y) num.ident(x,y)))
all((aaaa & !is.na(aaaa)) == (row(aaaa) == col(aaaa)))
# aaaa has TRUE only on the diagonal, i.e. identity works correctly
Run the code above in your browser using DataLab