Learn R Programming

gmp (version 0.2-2)

add.bigz: 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)
a + b (if a or b is a bigz vector)
sub.bigz(a, b)
a - b (if a or b is a bigz vector)
mul.bigz(a, b)
a * b (if a or b is a bigz vector)
div.bigz(a, b)
a / b (if a or b is a bigz vector)
mod.bigz(a, b)
a %% b (if a or b is a bigz vector)
inv.bigz(a, b,...)
inv(a, ...)
pow.bigz(a, b,...)
pow(a, ...)
a ^ b (if a or b is a bigz vector)
log.bigz(x, base=exp(1))
log(a, base=exp(1)) (if a is a bigz vector)
log2.bigz(a)
log2(a) (if a is a bigz vector)
log10.bigz(a)
log10(a) (if a is a bigz vector)

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

Value

  • A bigz class representing the result of the arithmetic operation.

Details

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

References

Gnu MP Library see http://swox.com/gmp, Home page: http://mulcyber.toulouse.inra.fr/projects/gmp/[object Object],[object Object]

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

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

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

arith