asNumeric-methods | R Documentation |
asNumeric(<mpfr>)
Methods for function asNumeric
(in package gmp).
## S4 method for signature 'mpfrArray'
asNumeric(x)
x |
a “number-like” object, here, a
|
an R object of type (typeof
) "numeric"
, a matrix
or array
if x
had non-NULL dimension dim()
.
signature(x = "mpfrArray")
this method also dispatches
for mpfrMatrix
and returns a numeric array.
signature(x = "mpfr")
for non-array/matrix,
asNumeric(x)
is basically the same as as.numeric(x)
.
Martin Maechler
our lower level (non-generic) toNum()
. Further,
asNumeric
(package gmp),
standard R's as.numeric()
.
x <- (0:7)/8 # (exact)
X <- mpfr(x, 99)
stopifnot(identical(asNumeric(x), x),
identical(asNumeric(X), x))
m <- matrix(1:6, 3,2)
(M <- mpfr(m, 99) / 5) ##-> "mpfrMatrix"
asNumeric(M) # numeric matrix
stopifnot(all.equal(asNumeric(M), m/5),
identical(asNumeric(m), m))# remains matrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.