Learn R Programming

Rmpfr (version 0.9-5)

Rmpfr-package: R MPFR - Multiple Precision Floating-Point Reliable

Description

Rmpfr provides S4 classes and methods for arithmetic including transcendental ("special") functions for arbitrary precision floating point numbers, here often called “mpfr - numbers”. To this end, it interfaces to the LGPL'ed MPFR (Multiple Precision Floating-Point Reliable) Library which itself is based on the GMP (GNU Multiple Precision) Library.

Arguments

Author

Martin Maechler

Details

tools:::Rd_package_DESCRIPTION("Rmpfr") tools:::Rd_package_indices("Rmpfr")

The following (help pages) index does not really mention that we provide many methods for mathematical functions, including gamma, digamma, etc, namely, all of R's (S4) Math group (with the only exception of trigamma), see the list in the examples. Additionally also pnorm, the “error function”, and more, see the list in zeta, and further note the first vignette (below).

Partial index:

mpfrCreate "mpfr" Numbers (Objects)
mpfrArrayConstruct "mpfrArray" almost as by array()
mpfr-classClass "mpfr" of Multiple Precision Floating Point Numbers
mpfrMatrix-classClasses "mpfrMatrix" and "mpfrArray"
BernoulliBernoulli Numbers in Arbitrary Precision
Bessel_mpfrBessel functions of Integer Order in multiple precisions
c.mpfrMPFR Number Utilities
cbind"mpfr" ... - Methods for Functions cbind(), rbind()
chooseMpfrBinomial Coefficients and Pochhammer Symbol aka
Rising Factorial
factorialMpfrFactorial 'n!' in Arbitrary Precision
formatMpfrFormatting MPFR (multiprecision) Numbers
getPrecRmpfr - Utilities for Precision Setting, Printing, etc
roundMpfrRounding to Binary bits, "mpfr-internally"
seqMpfr"mpfr" Sequence Generation
sumBinomMpfr(Alternating) Binomial Sums via Rmpfr
zetaSpecial Mathematical Functions (MPFR)
integrateROne-Dimensional Numerical Integration - in pure R
unirootROne Dimensional Root (Zero) Finding - in pure R
optimizeRHigh Precisione One-Dimensional Optimization
hjkMpfrHooke-Jeeves Derivative-Free Minimization R (working for MPFR)

Further information is available in the following vignettes:

Rmpfr-pkgArbitrarily Accurate Computation with R: The 'Rmpfr' package (source, pdf)
log1mexp-noteAcccurately Computing log(1 - exp(.)) -- Assessed by Rmpfr (source, pdf)

References

MPFR (MP Floating-Point Reliable Library), https://www.mpfr.org/

GMP (GNU Multiple Precision library), https://gmplib.org/

and see the vignettes mentioned above.

See Also

The R package gmp for big integer gmp and rational numbers (bigrational) on which Rmpfr depends.

Examples

Run this code
## Using  "mpfr" numbers instead of regular numbers...
n1.25 <- mpfr(5, precBits = 256)/4
n1.25

## and then "everything" just works with the desired chosen precision:hig
n1.25 ^ c(1:7, 20, 30) ## fully precise; compare with
print(1.25 ^ 30, digits=19)

exp(n1.25)

## Show all math functions which work with "MPFR" numbers (1 exception: trigamma)
getGroupMembers("Math")

## We provide *many* arithmetic, special function, and other methods:
showMethods(classes = "mpfr")
showMethods(classes = "mpfrArray")

Run the code above in your browser using DataLab