Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!ames!sgi!bron@bronze.SGI.COM From: bron@bronze.SGI.COM (Bron Campbell Nelson) Newsgroups: comp.sys.sgi Subject: Re: float vs double Summary: some info Keywords: float double Message-ID: <31617@sgi.SGI.COM> Date: 29 Apr 89 00:19:50 GMT References: <8904281948.AA28223@cartier.dgp.toronto.edu> Sender: daemon@sgi.SGI.COM Distribution: na Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 28 In article <8904281948.AA28223@cartier.dgp.toronto.edu>, ckchee@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@sgi.com or possibly ..!ames!sgi!bron These statements are my own, not those of Silicon Graphics.