[R] floating point in single precision

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Jun 27 08:39:10 CEST 2010


On Sun, 27 Jun 2010, Sebastian Gibb wrote:

> Hello,
>
> is there a possibilty in R to convert numbers (double precision, 64bit) into
> single precision ones (32bit).
> I need that for compatibility reasons. Until now I call a C application which
> casts a double to a float.
>
> float precision32(double value) {
>  return (float)value;
> }
>
> But I want to use a R only method. What can I do?

?as.single
?writeBin

> Kind regards,
>
> Sebastian

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list