Description Usage Arguments Value See Also Examples

Efficiently compute *n!* in arbitrary precision,
using the MPFR-internal implementation.
This is mathematically (but not numerically) the same as
*Gamma(n+1)*.

`factorialZ`

(package gmp) should typically be
used *instead* of `factorialMpfr()`

nowadays. Hence,
`factorialMpfr`

now is somewhat **deprecated**.

1 2 |

`n` |
non-negative integer (vector). |

`precBits` |
desired precision in bits (“binary digits”);
the default sets the precision high enough for the result to be |

`rnd.mode` |
a 1-letter string specifying how |

a number of (S4) class `mpfr`

.

`factorial`

and `gamma`

in base **R**.

`factorialZ`

(package gmp), to *replace*
`factorialMpfr`

, see above.

`chooseMpfr()`

and `pochMpfr()`

(on the same page).

1 2 3 4 5 6 7 8 9 10 11 | ```
factorialMpfr(200)
n <- 1000:1010
f1000 <- factorialMpfr(n)
stopifnot(1e-15 > abs(as.numeric(1 - lfactorial(n)/log(f1000))))
## Note that---astonishingly--- measurements show only
## *small* efficiency gain of ~ 10% : over using the previous "technique"
system.time(replicate(8, f1e4 <- factorialMpfr(10000)))
system.time(replicate(8, f.1e4 <- factorial(mpfr(10000,
prec=1+lfactorial(10000)/log(2)))))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.