float vs double

Bron Campbell Nelson bron at bronze.SGI.COM
Sat Apr 29 10:19:50 AEST 1989


In article <8904281948.AA28223 at cartier.dgp.toronto.edu>, ckchee at dgp.toronto.edu (Chuan Chee) writes:
> The assumptions I have about float are:
> (1) The floating point accelerator computes float expressions faster
>     than double expressions.
> (2) float takes half the amount of storage.
> 
These are both true.

If memory serves me, a "float" add take 2 clocks, a "float" multiply
takes 4 clocks, while "double" takes 3 and 6 respectively.  The
single to double conversion is (I believe) 1 clock.  This is from
memory; these times could easily be off by a clock or two.

These are extremely fast if you ask me, and the second order effects
caused by (2) start to be significant. i.e. the path to memory is only
32 bits wide, so loading/storing a double takes an extra clock; when
you miss the cache, you fetch twice as many floats as doubles, so you
do fewer fetches, etc.

I have seen about a 50% difference in float vs double for a floating
point intensive job (i.e. if the float version takes 2 seconds, the
double version takes 3 seconds).  This is just one data point; your
mileage will vary.

--
Bron Campbell Nelson
bron at sgi.com  or possibly  ..!ames!sgi!bron
These statements are my own, not those of Silicon Graphics.



More information about the Comp.sys.sgi mailing list