02. Arithmetic and logic {VeryLargeIntegers} | R Documentation |
Basic arithmetic and logical operators for vli (Very Large Integers) objects.
## S3 method for class 'vli' x + y ## S3 method for class 'vli' x - y ## S3 method for class 'vli' x * y ## S3 method for class 'vli' x / y ## S3 method for class 'vli' x %% y ## S3 method for class 'vli' abs(x) ## S3 method for class 'vli' x ^ y ## S3 method for class 'vli' x > y ## S3 method for class 'vli' x < y ## S3 method for class 'vli' x >= y ## S3 method for class 'vli' x <= y ## S3 method for class 'vli' x == y ## S3 method for class 'vli' x != y
x |
object of class vli or 32 bits integer |
y |
object of class vli or 32 bits integer |
As in the creation of vli objects (through the function as.vli
), punctuation signs will be ignored (see the last example).
The algorithm implemented for the operator "*
" computes the product with a trivial method when imput numbers have less than 40 digits and with the Karatsuba algorithm for fast multiplications when they are larger.
objects of class vli with the arithmetic operators; booleans with the logical operators
Javier Leiva Cuadrado
x <- as.vli("712376544526091241") x ^ 61 x / as.vli("4225234") x > -x x <= 10000000 13.2415 - as.vli(132415)