

   Arithmetic {base}                            R Documentation

   AArriitthhmmeettiicc OOppeerraattoorrss

   DDeessccrriippttiioonn::

        These binary operators perform arithmetic on vector
        objects.

   UUssaaggee::

        x + y
        x - y
        x * y
        x / y
        x ^ y
        x %% y
        x %/% y

   DDeettaaiillss::

        `1 ^ y' and `y ^ 0' are `1', always.  `x ^ y' should
        also give the proper ``limit'' result when either argu-
        ment is infinite (i.e., `+- Inf').

        Objects such as arrays or time-series can be operated
        on this way provided they are conformable.

   VVaalluuee::

        They return numeric vectors containing the result of
        the element by element operations.  The elements of
        shorter vectors are recycled as necessary.  The opera-
        tors are `+' for addition, `-' for subtraction `*' for
        multiplication, `/' for division and `^' for exponenti-
        ation.

        `%%' indicates `x mod y' and `%/%' indicates integer
        division.  It is guaranteed that `x  ==  (x %% y)  +  y
        * ( x %/% y )' unless `y == 0' where the result is `NA'
        or `NaN' (depending on the `typeof' of the arguments).

   SSeeee AAllssoo::

        `Math' for miscellaneous and `Special' for special
        mathematical functions.

   EExxaammpplleess::

        x <- -1:12
        x + 1
        2 * x + 3
        x %% 2 #-- is periodic
        x %/% 5

