.BG
.FN double
.FN is.double
.FN as.double
.TL
Double Precision Objects
.CS
double(length=0)
is.double(x)
as.double(x)
.AG length
integer giving the length of the returned object.
.AG x
any S object.
.RT
`double' returns a simple object of storage mode `"double"', and the length specified.
.PP
`is.double' returns `TRUE' if `x' is a simple object of storage mode `"double"', and
`FALSE' otherwise.
.PP
`as.double' returns `x' if `x' is a simple object of storage mode `"double"', and
otherwise a vector of the same length as `x' and with data resulting
from coercing the elements of `x' to storage mode `double'.
.PP
These functions are needed when interfacing
to Fortran or C algorithms, where it is important to emphasize the exact
storage mode of data.
.PP
In most S expressions it is not
necessary to explicitly ensure that data is of a particular storage mode.
When testing for data suitable for arithmetic, for example, it is better to
use
`is.numeric(x)',
which will return `TRUE' for any numeric object.
Normally, S does numeric computations with double precision.
Explicit reference to storage mode `double' is usually only
relevant when passing arguments to Fortran or C routines that
have arguments with double precision or float declarations.
.PP
Note the difference between coercing to a vector
and setting the storage mode attribute:
.Cs
storage.mode(myobject) <- "double"
.Ce
This changes the storage mode of `myobject' but leaves all other attributes unchanged
(so a matrix stays a matrix, e.g.).  The value of `as.double(myobject)'
would have no attributes.
.SA
`\&.Fortran', `.C'.
.EX
z <- double(length(zz)) # double object same length as zz
\&.Fortran("mydsub",as.double(xm))
.KW classes
.WR
