Debian Codegraph @

man/signi.Rd

raw
1 \name{signi}
2 \alias{signi}
3 \title{Rounding to Significant Digits}
4 \description{
5 Rounds to significant digits similarly to \code{\link{signif}}.
6 }
7 \usage{
8 signi(x, digits = 6)
9 }
10 \arguments{
11 \item{x}{numeric vector to be rounded.}
12 \item{digits}{number of significant digits required.}
13 }
14 \value{
15 numeric vector \dQuote{close} to \code{x}, i.e. by at least \code{digits}
16 significant digits.
17 }
18 \author{Martin Maechler, in prehistoric times (i.e. before 1990).}
19 \note{
20 This is really just \code{round(x, digits - trunc(log10(abs(x))))} and
21 hence mainly of didactical use. Rather use \code{signif()} otherwise.
22 }
23 \seealso{\code{\link{signif}}, \code{\link{round}}.}
24 \examples{
25 (x1 <- seq(-2, 4, by = 0.5))
26 identical(x1, signi(x1))# since 0.5 is exact in binary arithmetic
27 (x2 <- pi - 3 + c(-5,-1,0, .1, .2, 1, 10,100))
28 signi(x2, 3)
29 }
30 \keyword{arith}