bigq {gmp}R Documentation

Large sized rationals

Description

Type class supporting arithmetic operations on very large rationals.

Usage

as.bigq(n, d = 1)
as.character.bigq(a,b=10)
as.double.bigq(x,...)
as.bigz.bigq(a,mod=NA)
is.na.bigq(a)
print.bigq(x,...)
denominator(x)
numerator(x)

Arguments

n,d Either integer, numeric or string value (String value: ither starting with 0x for hexadecimal, 0b for binary or without prefix for decimal values. Any format error results in 0). n stands for numerator, d for denominator
a An element of class bigq
mod Optional modulus to convert into biginteger
x Numeric value
b Base: from 2 to 32
... Additional parameters

Details

as.bigz.bigq returns the smallest integers not less than the corresponding rationals bigq.

Value

A bigq class representing the parameter value.

Author(s)

Antoine Lucas

References

http://mulcyber.toulouse.inra.fr/projects/gmp/

Examples

x <- as.bigq(21,6)
x
# 7 / 2
# Wow ! result is simplified.

y <- as.bigq(5,3)

# addition work !
x + y

# You can even try multiplication, division...
x * y / 13 

# convert to string, double
as.character(x)
as.double(x)


[Package gmp version 0.4-1 Index]