Brobdingnag-package {Brobdingnag} | R Documentation |

Handles very large numbers in R. Real numbers are held using their natural logarithms, plus a logical flag indicating sign. The package includes a vignette that gives a step-by-step introduction to using S4 methods.

The DESCRIPTION file:

Package: | Brobdingnag |

Type: | Package |

Title: | Very Large Numbers in R |

Version: | 1.2-6 |

Date: | 2018-08-08 |

Author: | Robin K. S. Hankin |

Depends: | R (>= 2.13.0), methods |

Maintainer: | Robin K. S. Hankin <hankin.robin@gmail.com> |

Description: | Handles very large numbers in R. Real numbers are held using their natural logarithms, plus a logical flag indicating sign. The package includes a vignette that gives a step-by-step introduction to using S4 methods. |

LazyLoad: | yes |

License: | GPL |

Repository: | CRAN |

URL: | https://github.com/RobinHankin/Brobdingnag.git |

Index of help topics:

Arith-methods Methods for Function Arith in package Brobdingnag Brobdingnag-package Very Large Numbers in R Compare-methods Methods for Function Compare in Package Brobdingnag Re Real and imaginary manipulation [.brob Extract or Replace Parts of brobs or glubs abs Various logarithmic and circular functions for brobs as.numeric Coerces to numeric or complex form brob Brobdingnagian numbers brob-class Class "brob" cbrob Combine Brobdingnagian vectors getP Get and set methods for brob objects glub Glubbdubdribian numbers: complex numbers with Brobdingnagian real and imaginary parts glub-class Class "glub" length Get lengths of brobs and glubs logic.brob Logical operations on brobs plot Basic plotting of Brobs print.brob Methods for printing brobs and glubs sum Various summary statistics for brobs and glubs swift-class Class "swift"

Real numbers are represented by two objects: a real, holding the
logarithm of their absolute values; and a logical, indicating the
sign. Multiplication and exponentiation are easy: the challenge is
addition. This is achieved using the (trivial) identity
*log(e^x+e^y)=x+log(1+e^(y-x))*
where, WLOG, *y<x*.

Complex numbers are stored as a pair of `brob`

s: objects of class
`glub`

.

The package is a simple example of S4 methods.

However, it *could* be viewed as a cautionary tale: the
underlying **R** concepts are easy yet the S4 implementation is long and
difficult. I would not recommend using S4 methods for a package as
simple as this; S3 methods would have been perfectly adequate.
I would suggest that S4 methods should only be used when S3 methods
are *demonstrably* inadequate.

Robin K. S. Hankin

Maintainer: Robin K. S. Hankin <hankin.robin@gmail.com>

R. K. S. Hankin 2007. “Very Large Numbers in R: Introducing Package Brobdingnag”. R News, volume 7, number 3, pages 15-16

googol <- as.brob(10)^100 googol googol + googol/2 1/(googol + 1e99) (1:10)^googol googolplex <- 10^googol googolplex googolplex * googol # practically the same as googolplex (!)

[Package *Brobdingnag* version 1.2-6 Index]