Brobdingnag (version 1.2-6)

brob: Brobdingnagian numbers

Description

Create, coerce to or test for a Brobdingnagian object

Usage

brob(x = double(), positive)
as.brob(x)
is.brob(x)

Arguments

x

Quantity to be tested, coerced in to Brobdingnagian form

positive

In function brob(), logical indicating whether the number is positive (actually, positive or zero)

Details

Function as.brob() is the user's workhorse: use this to coerce numeric vectors to brobs.

Function is.brob() tests for its arguments being of class brob.

Function brob() takes argument x and returns a brob formally equal to \(e^x\); set argument positive to FALSE to return \(-e^x\). Thus calling function exp(x) simply returns brob(x). This function is not really intended for the end user: it is confusing and includes no argument checking. In general numerical work, use function as.brob() instead, although be aware that if you really really want \(e^{10^7}\), you should use brob(1e7); this would be an exact representation.

See Also

glub

Examples

Run this code
# NOT RUN {
googol <- as.brob(10)^100
googolplex <- 10^googol

(googolplex/googol) / googolplex
#  Thus googolplex/googol == googolplex (!)


# use cbrob() instead of c() when Brobdingnagian numbers are involved:
cbrob(4,exp(as.brob(1e55)))


# }

Run the code above in your browser using DataCamp Workspace