powered by
Addition, subtraction, multiplication, division, and absolute value for large rationals, i.e. "bigq" class R objects.
"bigq"
add.bigq(e1, e2) # S3 method for bigq +(e1, e2)sub.bigq(e1, e2=NULL) # S3 method for bigq -(e1, e2)mul.bigq(e1, e2) # S3 method for bigq *(e1, e2)div.bigq(e1, e2) # S3 method for bigq /(e1, e2)# S3 method for bigq ^(e1, e2)# S3 method for bigq abs(x)
sub.bigq(e1, e2=NULL) # S3 method for bigq -(e1, e2)
mul.bigq(e1, e2) # S3 method for bigq *(e1, e2)
div.bigq(e1, e2) # S3 method for bigq /(e1, e2)
# S3 method for bigq ^(e1, e2)
# S3 method for bigq abs(x)
A bigq class representing the result of the arithmetic operation.
of class "bigq", or (e1 and e2) integer or string from an integer
e1
e2
Immanuel Scholz and Antoine Lucas
Operators can be use directly when the objects are of class "bigq": a + b, a * b, etc, and a ^ n, where n must be coercable to a biginteger ("bigz").
a ^ n
n
"bigz"
## 1/3 + 1 = 4/3 : as.bigq(1,3) + 1 r <- as.bigq(12, 47) stopifnot(r ^ 3 == r*r*r)
Run the code above in your browser using DataLab