.BG
.FN single
.FN is.single
.FN as.single
.TL
Single Precision Objects
.CS
single(length=0)
is.single(x)
as.single(x)
.AG length
length desired for the resulting object.
.AG x
any S object.
.RT
`single' returns a simple object of storage mode single, and the length specified.
.PP
`is.single' returns `TRUE' if `x' is a simple object of storage mode single, and
`FALSE' otherwise.
.PP
`as.single' returns `x' if `x' is a simple object of storage mode single, and
otherwise a single object of the same length as `x' and with data resulting
from coercing the elements of `x' to storage mode single.
.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.
About the only need for storage mode single comes when using the interface to
a Fortran subroutine with arguments that are declared `REAL'.
(see `.Fortran'.)
.PP
Note the difference between coercing to a simple object of storage mode single
and setting the storage mode attribute:
.Cs
storage.mode(myobject) <- "single"
.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.single(myobject)'
would have no attributes.
.SA
`\&.Fortran', `.C'.
.EX
z <- single(length(zz)) # a single object same length as zz
\&.Fortran("mysub",as.single(x))
.KW classes
.WR
