Skip to content
Prev 40792 / 63424 Next

Manipulating single-precision (float) arrays in .Call functions

On Mon, 18 Jul 2011, Alireza Mahani wrote:

            
The main reason to use only double precision in R was that on modern 
CPUs double precision calculations are as fast as single-precision 
ones, and with 64-bit CPUs they are a single access.  So the extra 
precision comes more-or-less for free.  You also under-estimate the 
extent to which stability of commonly used algorithms relies on double 
precision.  (There are stable single-precision versions, but they are 
no longer commonly used.  And as Simon said, in some cases stability 
is ensured by using extra precision where available.)

I disagree slightly with Simon on GPUs: I am told by local experts 
that the double-precision on the latest GPUs (those from the last year 
or so) is perfectly usable.  See the performance claims on 
http://en.wikipedia.org/wiki/Nvidia_Tesla of about 50% of the SP 
performance in DP.