05. Efficent division by a power of 2 | R Documentation |
divp2
efficiently divides an object of class vli by a power of 2.
## S3 method for class 'vli'
divp2(x, k)
## Default S3 method:
divp2(x, k)
## S3 method for class 'numeric'
divp2(x, k)
## S3 method for class 'vli'
divp2(x, k)
x |
dividend; object of class vli or 32 bits integer |
k |
exponent of the divisor (the divisor will be |
Given two integers x
(vli or 32 bits integer) and k
(32 bits integer), the function divp2(x, k)
computes and returns x/(2^k)
as an object of class vli.
object of class vli
Javier Leiva Cuadrado
# Dividing a random 500 digits integer by 2^10 = 1024
x <- rvlidigits(500)
x
divp2(x, 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.