roots: Integer roots for vli Objects

03. RootsR Documentation

Integer roots for vli Objects

Description

Computation of integer roots and their remainders of vli (Very Large Integers) objects. Functions sqrt and rootk returns respectively the integer square root and the integer k-th root of the given value. Functions sqrtrem and rootkrem returns the corresponding remainder.

Usage

## S3 method for class 'vli'
sqrt(x)

sqrtrem(x)

## Default S3 method:
sqrtrem(x)

## S3 method for class 'numeric'
sqrtrem(x)

## S3 method for class 'vli'
sqrtrem(x)

rootk(x, k)

## Default S3 method:
rootk(x, k)

## S3 method for class 'numeric'
rootk(x, k)

## S3 method for class 'vli'
rootk(x, k)

rootkrem(x, k)

## Default S3 method:
rootkrem(x, k)

## S3 method for class 'numeric'
rootkrem(x, k)

## S3 method for class 'vli'
rootkrem(x, k)

Arguments

x

base of the root; object of class vli or 32 bits integer

k

index of the root; object of class vli or 32 bits integer

Value

object of class vli

Author(s)

Javier Leiva Cuadrado

Examples

x <- as.vli("4124135")
sqrt(x)
sqrtrem(x)
sqrt(x)^2 + sqrtrem(x) == x
## Not run: 
rootk(as.vli("1492346293864978561249785"), 5)

## End(Not run)

VeryLargeIntegers documentation built on May 31, 2023, 7:06 p.m.