Floating point processing

Don Cross dcross at intersrv.com
Wed Jul 15 16:06:47 EDT 1998

Hello all,

Chris Townsend wrote:
> ... 
> Another thing I found is that converting DSP code from single to double
> precision more than doubled the CPU utilization (at least on a Pentium II).
>  This seems somewhat strange to me, since all operations are performed at
> 80 bits.  Of course double precision will require twice as much data to be
> moved around in memory, but I'm not sure that this could completely account
> for the large change in CPU utilization.  Any thoughts?

I noticed this a couple years back also.  When I disassembled the 32-bit
code generated by the MSVC++ compiler (View | Disassembly menu command
during debug), it looked like using 'float' instead of 'double' caused
the compiler to have to constantly convert between 'float' and 'double'
using calls to routines in the runtime library.  I believe a lot of this
is due to the implicit promotion rules for data types in the C and C++

Using all 'double' for instensive calculations made these function calls
go away, hence speedier code.  Now, the only time I use 'float' is in
large arrays where I need to conserve memory.  Otherwise, I use double
precision wherever I can, just to get the speed-up.


   Don Cross <dcross at intersrv.com>

More information about the music-dsp mailing list