Learn R Programming

frab (version 0.0-6)

Arith: Arithmetic methods for class "frab"

Description

The frab class provides basic arithmetic methods for frab objects. Arithmetic operations are generally dispatched to one of self-describing functions in the following list:

  • frab_negative()

  • frab_reciprocal()

  • frab_plus_frab()

  • frab_multiply_frab()

  • frab_plus_numeric()

  • frab_multiply_numeric()

  • frab_power_numeric()

  • numeric_power_frab()

The most important one is, of course, frab_plus_frab() which is the sine qua non for the whole package. But these functions are not intended for user and are somewhat unfriendly. Use the arithmetic operators, as in “a + 2*b” instead.

Low-level helper functions c_frab_add() and c_frab_multiply() etc. are generated by compileAttributes(). They call the C routines in the src directory. Low-level helper function c_frab_pmax() is documented here for consistency; but technically c_frab_pmax() is an “Extremes” function. They are documented at Compare and pmax respectively.

Usage

frab_negative(x)
frab_reciprocal(x)
frab_plus_frab(F1,F2)
frab_multiply_numeric(e1,e2)
frab_power_numeric(e1,e2)
numeric_power_frab(e1,e2)
frab_unary(e1,e2)
frab_arith_frab(e1,e2)
frab_plus_numeric(e1,e2)
frab_arith_numeric(e1,e2)
numeric_arith_frab(e1,e2)

Value

Return frab objects

Arguments

e1,e2,x,F1,F2

Objects of class frab, coerced if needed

Methods

Arith

signature(e1="frab" , e2="missing"): blah blah blah

Arith

signature(e1="frab" , e2="frab" ): ...

Arith

signature(e1="frab" , e2="numeric"): ...

Arith

signature(e1="numeric", e2="frab" ): ...

Arith

signature(e1="ANY" , e2="frab" ): ...

Arith

signature(e1="frab" , e2="ANY" ): ...

Author

Robin K. S. Hankin

See Also

Compare

Examples

Run this code

(x <- frab(c(a=1,b=2,c=3)))
(y <- frab(c(b=-2,d=8,x=1,y=7)))
(z <- frab(c(c=2,x=5,b=1,a=6)))


x+y
x+y+z

x*y


Run the code above in your browser using DataLab