2298467028 > x2 <- pi * 100^(-1:3) > round(x2, 3) [1] 0.031 3.142 314.159 31415.927 [5] 3141592.654 这个没问题。 但是下面是个什么情况,不明白啊! > x <- 123456789.987654321 > round(x,12) [1] 123456790 > round(x,2) [1] 123456790
lyxmoo options()$digits help 要看呐~ 看呐~ 看~呐 ~呐 ?round() Arguments x a numeric vector. Or, for round and signif, a complex vector.
neo.cryptic lz设定的精度不够。。试试: > x<br /> [1] 123456789.9876543283463<br /> > options(digits = 21)<br /> > round(x, 12)<br /> [1] 123456789.987654328346 </p>