Machine                 package:base                 R Documentation

_M_a_c_h_i_n_e _C_h_a_r_a_c_t_e_r_i_s_t_i_c_s

_D_e_s_c_r_i_p_t_i_o_n:

     `Machine()' returns information on numeric characteristics of the
     machine R is running on, such as the largest double or integer and
     the machine's precision.

     `.Machine' is a variable holding this information.

_U_s_a_g_e:

     Machine()
     .Machine

_D_e_t_a_i_l_s:

     The algorithm is based on Cody's (1988) subroutine MACHAR.

_V_a_l_u_e:

     `Machine()' returns a list with components (for simplicity, the
     prefix ``double'' is omitted in the explanations) 

double.eps: the smallest positive floating-point number `x' such that
          `1 + x != 1'.  It equals `base^ulp.digits' if either `base'
          is 2 or `rounding' is 0;  otherwise, it is `(base^ulp.digits)
          / 2'.

double.neg.eps: a small positive floating-point number `x' such that `1
          - x != 1'.  It equals `base^neg.ulp.digits' if `base' is 2 or
          `round' is 0;  otherwise, it is `(base^neg.ulp.digits) / 2'.
          As `neg.ulp.digits' is bounded below by `-(digits + 3)',
          `neg.eps' may not be the smallest number that can alter 1 by
          subtraction.

double.xmin: the smallest non-vanishing normalized floating-point power
          of the radix, i.e., `base^min.exp'.

double.xmax: the largest finite floating-point number. Typically, it is
          equal to `(1 - neg.eps) * base^max.exp', but on some machines
          it is only the second, or perhaps third, largest number,
          being too small by 1 or 2 units in the last digit of the
          significand.

double.base: the radix for the floating-point representation

double.digits: the number of base digits in the floating-point
          significand

double.rounding: the rounding action. 
          0 if floating-point addition chops; 
          1 if floating-point addition rounds, but not in the IEEE
          style; 
          2 if floating-point addition rounds in the IEEE style; 
          3 if floating-point addition chops, and there is partial
          underflow; 
          4 if floating-point addition rounds, but not in the IEEE
          style, and there is partial underflow; 
          5 if floating-point addition rounds in the IEEE style, and
          there is partial underflow

double.guard: the number of guard digits for multiplication with
          truncating arithmetic.  It is 1 if floating-point arithmetic
          truncates and more than `digits' base `base' digits
          participate in the post-normalization shift of the
          floating-point significand in multiplication, and 0
          otherwise.

double.ulp.digits: the largest negative integer `i' such that `1 +
          base^i != 1', except that it is bounded below by `-(digits +
          3)'.

double.neg.ulp.digits: the largest negative integer `i' such that `1 -
          base^i != 1', except that it is bounded below by `-(digits +
          3)'.

double.exponent: the number of bits (decimal places if `base' is 10)
          reserved for the representation of the exponent (including
          the bias or sign) of a floating-point number

double.min.exp: the largest in magnitude negative integer `i' such that
          `base ^ i' is positive and normalized.

double.max.exp: the smallest positive power of `base' that overflows.

integer.max: the largest integer which can be represented.

_R_e_f_e_r_e_n_c_e_s:

     Cody, W. J. (1988) MACHAR: A subroutine to dynamically determine
     machine parameters. Transactions on Mathematical Software, 14, 4,
     303-311.

_S_e_e _A_l_s_o:

     `machine' to determine the computer type which R is running on.

_E_x_a_m_p_l_e_s:

     str(Machine())
     (Meps <- .Machine $ double.eps)

     ## All the following relations must hold :
     stopifnot(
      1 +     Meps != 1,
      1 + .5* Meps == 1,
      log2(.Machine$double.xmax) == .Machine$double.max.exp,
      log2(.Machine$double.xmin) == .Machine$double.min.exp,
      is.infinite(.Machine$double.base ^ .Machine$double.max.exp)
     )

