powered by
Rounds to significant digits similarly to signif.
signif
signi(x, digits = 6)
numeric vector “close” to x, i.e. by at least digits
x
digits
significant digits.
numeric vector to be rounded.
number of significant digits required.
Martin Maechler, in prehistoric times (i.e. before 1990).
signif, round.
round
(x1 <- seq(-2, 4, by = 0.5)) identical(x1, signi(x1))# since 0.5 is exact in binary arithmetic (x2 <- pi - 3 + c(-5,-1,0, .1, .2, 1, 10,100)) signi(x2, 3)
Run the code above in your browser using DataLab