arithmeticlogic: Basic Arithmetic and Logical Operators for vli Objects

02. Arithmetic and logicR Documentation

Basic Arithmetic and Logical Operators for vli Objects

Description

Basic arithmetic and logical operators for vli (Very Large Integers) objects.

Usage

## 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

Arguments

x

object of class vli or 32 bits integer

y

object of class vli or 32 bits integer

Details

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.

Value

objects of class vli with the arithmetic operators; booleans with the logical operators

Author(s)

Javier Leiva Cuadrado

Examples

x <- as.vli("712376544526091241")
x ^ 61
x / as.vli("4225234")
x > -x
x <= 10000000
13.2415 - as.vli(132415)

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