is.finite                package:base                R Documentation

_F_i_n_i_t_e, _I_n_f_i_n_i_t_e _a_n_d _N_a_N _N_u_m_b_e_r_s

_D_e_s_c_r_i_p_t_i_o_n:

     'is.finite' and 'is.infinite' return a vector of the same length
     as 'x', indicating which elements are finite (not infinite and not
     missing).

     'Inf' and '-Inf' are positive and negative "infinity" whereas
     'NaN' means "Not a Number".

_U_s_a_g_e:

     is.finite(x)
     is.infinite(x)
     Inf
     NaN
     is.nan(x)

_A_r_g_u_m_e_n_t_s:

       x: (numerical) object to be tested.

_D_e_t_a_i_l_s:

     'is.finite' returns a vector of the same length as 'x' the jth
     element of which is 'TRUE' if 'x[j]' is finite (i.e., it is not
     one of the values 'NA', 'NaN', 'Inf' or '-Inf').  All elements of
     character and generic (list) vectors are false, so 'is.finite' is
     only useful for logical, integer, numeric and complex vectors. 
     Complex numbers are finite if both the real and imaginary parts
     are.

     'is.infinite' returns a vector of the same length as 'x' the jth
     element of which is 'TRUE' if 'x[j]' is infinite (i.e., equal to
     one of 'Inf' or '-Inf').

     'is.nan' tests if a numeric value is 'NaN'.  Do not test equality
     to 'NaN', or even use 'identical', since systems typically have
     many different NaN values. In most ports of R one of these is used
     for the numeric missing value 'NA'.  It is generic: you can write
     methods to handle of specific classes of objects, see
     InternalMethods.

_N_o_t_e:

     In R, basically all mathematical functions (including basic
     'Arithmetic'), are supposed to work properly with '+/- Inf' and
     'NaN' as input or output.

     The basic rule should be that calls and relations with 'Inf's
     really are statements with a proper mathematical _limit_.

_R_e_f_e_r_e_n_c_e_s:

     ANSI/IEEE 754 Floating-Point Standard.

     Currently (6/2002), Bill Metzenthen's billm@suburbia.net tutorial
     and examples at 
      <URL: http://www.suburbia.net/~billm/>

_S_e_e _A_l_s_o:

     'NA', '_Not Available_' which is not a number as well, however
     usually used for missing values and applies to many modes, not
     just numeric.

_E_x_a_m_p_l_e_s:

     pi / 0 ## = Inf a non-zero number divided by zero creates infinity
     0 / 0  ## =  NaN

     1/0 + 1/0# Inf
     1/0 - 1/0# NaN

     stopifnot(
         1/0 == Inf,
         1/Inf == 0
     )
     sin(Inf)
     cos(Inf)
     tan(Inf)

