signi                package:sfsmisc                R Documentation

_R_o_u_n_d_i_n_g _t_o _S_i_g_n_i_f_i_c_a_n_t _D_i_g_i_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     Rounds to significant digits similarly to 'signif'.

_U_s_a_g_e:

     signi(x, digits = 6)

_A_r_g_u_m_e_n_t_s:

       x: numeric vector to be rounded.

  digits: number of significant digits required.

_V_a_l_u_e:

     numeric vector ``close'' to 'x', i.e. by at least 'digits'
     significant digits.

_N_o_t_e:

     This is really just 'round(x, digits - trunc(log10(abs(x))))' and
     hence mainly of didactical use.   Rather use 'signif()' otherwise.

_A_u_t_h_o_r(_s):

     Martin Maechler, in prehistoric times (i.e. before 1990).

_S_e_e _A_l_s_o:

     'signif', 'round'.

_E_x_a_m_p_l_e_s:

     (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)

