Learn R Programming

gmp (version 0.3-4)

bigq: 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

a,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)
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.

References

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

Examples

Run this code
x <- as.bigq(21,6)
x
# 7 / 2
# Wow ! result is simplify.

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