Coerce from and to big integers (bigz
) and
mpfr
numbers.
Further, coerce from big rationals (bigq
) to
mpfr
numbers.
1 2 3 
x 
an R object of class 
precB 
precision in bits for the result. The default,

rnd.mode 
a 1letter string specifying how rounding
should happen at Clevel conversion to MPFR, see details of

mod 
a possible modulus, see 
Note that we also provide the natural (S4) coercions,
as(x, "mpfr")
for x
inheriting from class "bigz"
or "bigq"
.
a numeric vector of the same length as x
, of the desired class.
mpfr()
, as.bigz
and
as.bigq
in package gmp.
1 2 3 4 5 6 7 8 9 10 11 12 13 14  S < gmp::Stirling2(50,10)
show(S)
SS < S * as.bigz(1:3)^128
stopifnot(all.equal(log2(SS[2])  log2(S), 128, tolerance=1e15),
identical(SS, .mpfr2bigz(.bigz2mpfr(SS))))
.bigz2mpfr(S) # 148 bit precision
.bigz2mpfr(S, precB=256) # 256 bit
## rational > mpfr:
sq < SS / as.bigz(2)^100
MP < as(sq, "mpfr")
stopifnot(identical(MP, .bigq2mpfr(sq)),
SS == MP * as(2, "mpfr")^100)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.