bigz operators {gmp}R Documentation

Basic arithmetic operators for large integers

Description

Addition, substraction, multiplication, division, remainder of division, multiplicative inverse, power and logarithm functions.

Usage

add.bigz(a, b)
sub.bigz(a, b = NULL)
mul.bigz(a, b)
div.bigz(a, b)
divq.bigz(a,b)
mod.bigz(a, b)
abs.bigz(x)
inv.bigz(a, b,...)
inv(a, ...)
pow.bigz(a, b,...)
pow(a, ...)
log.bigz(x, base=exp(1))
log2.bigz(a)
log10.bigz(a)

Arguments

x bigz, integer or string from an integer
a bigz, integer or string from an integer
b bigz, integer or string from an integer
base base of the logarithm; base e as default
... Additional parameters

Details

For details about the internal modulus state, see the manpage of "bigz".

div or "/" return a rational number; divq or "%/%" return the quotient of division.

Operators can be use directly when objects are of class bigz: a + b, log(a), etc.

Value

A bigz class representing the result of the arithmetic operation.

Author(s)

Immanuel Scholz and Antoine Lucas

References

Gnu MP Library see http://swox.com/gmp

Examples

# 1+1=2
as.bigz(1) + 1

# if my_large_number_string is set to a number, it returns the least byte
## Not run: 
mod.bigz(as.bigz(my_large_number_string),"0xff")
## End(Not run)

# power exponents can be up to MAX_INT in size, or unlimited if a 
# bigz's modulus is set.
pow.bigz(10,10000)

[Package gmp version 0.4-11 Index]