# Rmpfr-package: R MPFR - Multiple Precision Floating-Point Reliable In Rmpfr: 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.

## Details

 Package: Rmpfr SystemRequirements: gmp (>= 4.2.3), mpfr (>= 3.0.0) (C (not R!) libraries; must be installed) Depends: methods, gmp (>= 0.5-8), R (>= 2.12.0) Imports: gmp, stats, utils Suggests: MASS, polynom, sfsmisc (>= 1.0-20), Matrix SuggestNotes: MASS, polynom, sfsmisc are only needed for vignette; Matrix only because of its test-tools URL: http://rmpfr.r-forge.r-project.org/ License: GPL (>= 2)

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:

 `mpfr` Create "mpfr" Numbers (Objects) `mpfrArray` Construct "mpfrArray" almost as by `array()` `mpfr-class` Class "mpfr" of Multiple Precision Floating Point Numbers `mpfrMatrix-class` Classes "mpfrMatrix" and "mpfrArray" `Bernoulli` Bernoulli Numbers in Arbitrary Precision `Bessel_mpfr` Bessel functions of Integer Order in multiple precisions `c.mpfr` MPFR Number Utilities `cbind` "mpfr" `...` - Methods for Functions cbind(), rbind() `chooseMpfr` Binomial Coefficients and Pochhammer Symbol aka Rising Factorial `factorialMpfr` Factorial 'n!' in Arbitrary Precision `formatMpfr` Formatting MPFR (multiprecision) Numbers `getPrec` Rmpfr - Utilities for Precision Setting, Printing, etc `roundMpfr` Rounding to Binary bits, "mpfr-internally" `seqMpfr` "mpfr" Sequence Generation `sumBinomMpfr` (Alternating) Binomial Sums via Rmpfr `zeta` Special Mathematical Functions (MPFR) `integrateR` One-Dimensional Numerical Integration - in pure R `unirootR` One Dimensional Root (Zero) Finding - in pure R `optimizeR` High Precisione One-Dimensional Optimization `hjkMpfr` Hooke-Jeeves Derivative-Free Minimization R (working for MPFR)

Further information is available in the following vignettes:

 `Rmpfr-pkg` Rmpfr (source, pdf) `log1mexp-note` Acccurately Computing log(1 - exp(.)) -- Assessed by Rmpfr (source, pdf)

Martin Maechler

## References

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

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

and see the vignettes mentioned above.

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

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16``` ```## 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") ```

### Example output

```Loading required package: gmp

Attaching package: 'gmp'

The following objects are masked from 'package:base':

%*%, apply, crossprod, matrix, tcrossprod

C code of R package 'Rmpfr': GMP using 64 bits per limb

Attaching package: 'Rmpfr'

The following objects are masked from 'package:stats':

dbinom, dnorm, dpois, pnorm

The following objects are masked from 'package:base':

cbind, pmax, pmin, rbind

1 'mpfr' number of precision  256   bits
[1] 1.25
9 'mpfr' numbers of precision  256   bits
[1]                                                             1.25
[2]                                                           1.5625
[3]                                                         1.953125
[4]                                                       2.44140625
[5]                                                     3.0517578125
[6]                                                   3.814697265625
[7]                                                 4.76837158203125
[8]                      86.7361737988403547205962240695953369140625
[9] 807.793566946316088741610050849573099185363389551639556884765625
[1] 807.7935669463161048
1 'mpfr' number of precision  256   bits
[1] 3.490342957461841376130546029672265482651734398762351622499696738335271802605519
[1] "abs"      "sign"     "sqrt"     "ceiling"  "floor"    "trunc"
[7] "cummax"   "cummin"   "cumprod"  "cumsum"   "exp"      "expm1"
[13] "log"      "log10"    "log2"     "log1p"    "cos"      "cosh"
[19] "sin"      "sinh"     "tan"      "tanh"     "acos"     "acosh"
[25] "asin"     "asinh"    "atan"     "atanh"    "cospi"    "sinpi"
[31] "tanpi"    "gamma"    "lgamma"   "digamma"  "trigamma"
Function: %*% (package base)
x="Mnumber", y="mpfr"
x="mpfr", y="Mnumber"
x="mpfr", y="mpfr"
x="mpfr", y="mpfrMatrix"
x="mpfrMatrix", y="mpfr"

Function: / (package base)
e1="mpfr", e2="numeric"
(definition from function "Arith")

Function: Arg (package base)
z="mpfr"

Function: Arith (package base)
e1="array", e2="mpfr"
e1="integer", e2="mpfr"
e1="mpfr", e2="array"
e1="mpfr", e2="integer"
e1="mpfr", e2="missing"
e1="mpfr", e2="mpfr"
e1="mpfr", e2="mpfrArray"
e1="mpfr", e2="numeric"
e1="mpfrArray", e2="mpfr"
e1="numeric", e2="mpfr"

Function: Compare (package methods)
e1="array", e2="mpfr"
e1="integer", e2="mpfr"
e1="mpfr", e2="array"
e1="mpfr", e2="integer"
e1="mpfr", e2="mpfr"
e1="mpfr", e2="mpfrArray"
e1="mpfr", e2="numeric"
e1="mpfrArray", e2="mpfr"
e1="numeric", e2="mpfr"

Function: Conj (package base)
z="mpfr"

Function: Im (package base)
z="mpfr"

Function: Logic (package base)
e1="mpfr", e2="mpfr"
e1="mpfr", e2="numeric"
e1="numeric", e2="mpfr"

Function: Math (package base)
x="mpfr"

Function: Math2 (package methods)
x="mpfr"

Function: Mod (package base)
z="mpfr"

Function: Ops (package base)
e1="array", e2="mpfr"
e1="bigq", e2="mpfr"
e1="bigz", e2="mpfr"
e1="mpfr", e2="array"
e1="mpfr", e2="bigq"
e1="mpfr", e2="bigz"
e1="mpfr", e2="vector"
e1="vector", e2="mpfr"

Function: Re (package base)
z="mpfr"

Function: Summary (package base)
x="mpfr"

Function: [ (package base)
x="mpfr", i="ANY", j="missing", drop="missing"
x="mpfr", i="logical", j="missing", drop="missing"
(inherited from: x="mpfr", i="ANY", j="missing", drop="missing")

Function: [<- (package base)
x="mpfr", i="ANY", j="missing", value="ANY"
x="mpfr", i="ANY", j="missing", value="mpfr"
x="mpfr", i="missing", j="missing", value="ANY"
x="mpfrArray", i="ANY", j="ANY", value="mpfr"
x="mpfrArray", i="ANY", j="missing", value="mpfr"
x="mpfrArray", i="matrix", j="missing", value="mpfr"
x="mpfrArray", i="missing", j="ANY", value="mpfr"
x="mpfrArray", i="missing", j="missing", value="mpfr"

Function: [[ (package base)
x="mpfr"

Function: ^ (package base)
e1="mpfr", e2="numeric"
(definition from function "Arith")

Function: abs (package base)
x="mpfr"

Function: all.equal (package base)
target="ANY", current="mpfr"
target="mpfr", current="ANY"
target="mpfr", current="mpfr"

Function: as.integer (package base)
x="mpfr"

Function: as.numeric (package base)
x="mpfr"

Function: asNumeric (package gmp)
x="mpfr"

Function: atan2 (package base)
y="ANY", x="mpfr"
y="mpfr", x="ANY"
y="mpfr", x="mpfr"
y="mpfr", x="numeric"
y="numeric", x="mpfr"

Function: beta (package base)
a="ANY", b="mpfr"
a="mpfr", b="ANY"
a="mpfr", b="mpfr"
a="mpfr", b="numeric"
a="numeric", b="mpfr"

Function: coerce (package methods)
from="array", to="mpfr"
from="bigq", to="mpfr"
from="bigz", to="mpfr"
from="character", to="mpfr"
from="integer", to="mpfr"
from="logical", to="mpfr"
from="mpfr", to="bigz"
from="mpfr", to="character"
from="mpfr", to="integer"
from="mpfr", to="mNumber"
from="mpfr", to="mpfr1"
from="mpfr", to="numeric"
from="mpfr1", to="mpfr"
from="numeric", to="mpfr"
from="raw", to="mpfr"

Function: coerce<- (package methods)
from="mpfr", to="list"

Function: crossprod (package gmp)
x="Mnumber", y="mpfr"
x="mpfr", y="Mnumber"
x="mpfr", y="missing"
x="mpfr", y="mpfr"
x="mpfr", y="mpfrMatrix"
x="mpfrMatrix", y="mpfr"

Function: dim (package base)

Function: dim<- (package base)
x="mpfr"

Function: exp (package base)
x="mpfr"
(definition from function "Math")

Function: factorial (package base)
x="mpfr"

Function: format (package base)
x="mpfr"

Function: initialize (package methods)
.Object="mpfr"
(inherited from: .Object="ANY")

Function: is.finite (package base)
x="mpfr"

Function: is.infinite (package base)
x="mpfr"

Function: is.na (package base)
x="mpfr"

Function: is.nan (package base)
x="mpfr"

Function: lbeta (package base)
a="ANY", b="mpfr"
a="mpfr", b="ANY"
a="mpfr", b="mpfr"
a="mpfr", b="numeric"
a="numeric", b="mpfr"

Function: log (package base)
x="mpfr"

Function: mean (package base)
x="mpfr"

Function: median (package stats)
x="mpfr"

Function: quantile (package stats)
x="mpfr"

Function: show (package methods)
object="mpfr"

Function: sign (package base)
x="mpfr"

Function: t (package base)
x="mpfr"

Function: tcrossprod (package gmp)
x="Mnumber", y="mpfr"
x="mpfr", y="Mnumber"
x="mpfr", y="missing"
x="mpfr", y="mpfr"
x="mpfr", y="mpfrMatrix"
x="mpfrMatrix", y="mpfr"

Function: unique (package base)
x="mpfr", incomparables="missing"

Function: which.max (package base)
x="mpfr"

Function: which.min (package base)
x="mpfr"

Function: Arith (package base)
e1="mpfr", e2="mpfrArray"
e1="mpfrArray", e2="mpfr"
e1="mpfrArray", e2="mpfrArray"
e1="mpfrArray", e2="numeric"
e1="numeric", e2="mpfrArray"

Function: Compare (package methods)
e1="mpfr", e2="mpfrArray"
e1="mpfrArray", e2="mpfr"
e1="mpfrArray", e2="numeric"
e1="numeric", e2="mpfrArray"

Function: [ (package base)
x="mpfrArray", i="ANY", j="ANY", drop="ANY"
x="mpfrArray", i="ANY", j="missing", drop="missing"
x="mpfrArray", i="matrix", j="missing", drop="missing"

Function: [<- (package base)
x="mpfrArray", i="ANY", j="ANY", value="ANY"
x="mpfrArray", i="ANY", j="ANY", value="mpfr"
x="mpfrArray", i="ANY", j="missing", value="ANY"
x="mpfrArray", i="ANY", j="missing", value="mpfr"
x="mpfrArray", i="matrix", j="missing", value="ANY"
x="mpfrArray", i="matrix", j="missing", value="mpfr"
x="mpfrArray", i="missing", j="ANY", value="ANY"
x="mpfrArray", i="missing", j="ANY", value="mpfr"
x="mpfrArray", i="missing", j="missing", value="ANY"
x="mpfrArray", i="missing", j="missing", value="mpfr"

Function: aperm (package base)
a="mpfrArray"

Function: apply (package gmp)
X="mpfrArray"

Function: as.vector (package base)
x="mpfrArray"

Function: asNumeric (package gmp)
x="mpfrArray"

Function: atan2 (package base)
y="ANY", x="mpfrArray"
y="mpfrArray", x="ANY"
y="mpfrArray", x="mpfrArray"

Function: beta (package base)
a="ANY", b="mpfrArray"
a="mpfrArray", b="ANY"
a="mpfrArray", b="mpfrArray"

Function: coerce (package methods)
from="mpfrArray", to="array"
from="mpfrArray", to="matrix"
from="mpfrArray", to="vector"

Function: coerce<- (package methods)
from="mpfrArray", to="vector"

Function: colMeans (package base)
x="mpfrArray"

Function: colSums (package base)
x="mpfrArray"

Function: dim (package base)
x="mpfrArray"

Function: dimnames (package base)
x="mpfrArray"

Function: dimnames<- (package base)
x="mpfrArray"

Function: initialize (package methods)
.Object="mpfrArray"

Function: is.finite (package base)
x="mpfrArray"

Function: is.infinite (package base)
x="mpfrArray"

Function: is.na (package base)
x="mpfrArray"

Function: is.nan (package base)
x="mpfrArray"

Function: lbeta (package base)
a="ANY", b="mpfrArray"
a="mpfrArray", b="ANY"
a="mpfrArray", b="mpfrArray"

Function: rowMeans (package base)
x="mpfrArray"

Function: rowSums (package base)
x="mpfrArray"

Function: show (package methods)
object="mpfrArray"

Function: sign (package base)
x="mpfrArray"
```

Rmpfr documentation built on Jan. 13, 2018, 1:11 a.m.