Learn R Programming

gmp (version 0.4-4)

bigq: Large sized rationals

Description

Type class supporting arithmetic operations on very large rationals.

Usage

as.bigq(n, d = 1)
as.character.bigq(x,b=10,...)
as.double.bigq(x,...)
as.bigz.bigq(a,mod=NA)
is.na.bigq(x)
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 numerato
a
An element of class bigq
mod
Optional modulus to convert into biginteger
x
Numeric value
b
Base: from 2 to 32
...
Additional parameters

Value

  • A bigq class representing the parameter value.

Details

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

References

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

Examples

Run this code
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)

Run the code above in your browser using DataLab